Class: ActiveEventStore::HaveEnqueuedAsyncSubscriberFor::EventMatcher

Inherits:
Object
  • Object
show all
Includes:
RSpec::Matchers::Composable
Defined in:
lib/active_event_store/rspec/have_enqueued_async_subscriber_for.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event) ⇒ EventMatcher

Returns a new instance of EventMatcher.



19
20
21
# File 'lib/active_event_store/rspec/have_enqueued_async_subscriber_for.rb', line 19

def initialize(event)
  @event = event
end

Instance Attribute Details

#eventObject (readonly)

Returns the value of attribute event.



17
18
19
# File 'lib/active_event_store/rspec/have_enqueued_async_subscriber_for.rb', line 17

def event
  @event
end

Instance Method Details

#descriptionObject



32
33
34
# File 'lib/active_event_store/rspec/have_enqueued_async_subscriber_for.rb', line 32

def description
  "be #{event.inspect}"
end

#matches?(actual_serialized) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
26
27
28
29
30
# File 'lib/active_event_store/rspec/have_enqueued_async_subscriber_for.rb', line 23

def matches?(actual_serialized)
  actual = ActiveEventStore.event_store.deserialize(
    **actual_serialized,
    serializer: ActiveEventStore.config.serializer
  )

  actual.event_type == event.event_type && data_matches?(actual.data)
end