class RubyEventStore::RSpec::Apply
Attributes
applied_events[R]
expected[R]
failure_message_formatter[R]
fetch_events[R]
Public Class Methods
new(*expected, failure_message_formatter:)
click to toggle source
# File lib/ruby_event_store/rspec/apply.rb, line 6 def initialize(*expected, failure_message_formatter:) @expected = ExpectedCollection.new(expected) @failure_message_formatter = failure_message_formatter @fetch_events = FetchUnpublishedEvents.new end
Public Instance Methods
description()
click to toggle source
# File lib/ruby_event_store/rspec/apply.rb, line 53 def description "apply events" end
exactly(count)
click to toggle source
# File lib/ruby_event_store/rspec/apply.rb, line 22 def exactly(count) expected.exactly(count) self end
failure_message()
click to toggle source
# File lib/ruby_event_store/rspec/apply.rb, line 45 def failure_message failure_message_formatter.failure_message(expected, applied_events) end
failure_message_when_negated()
click to toggle source
# File lib/ruby_event_store/rspec/apply.rb, line 49 def failure_message_when_negated failure_message_formatter.failure_message_when_negated(expected, applied_events) end
in(aggregate)
click to toggle source
# File lib/ruby_event_store/rspec/apply.rb, line 12 def in(aggregate) fetch_events.in(aggregate) self end
matches?(event_proc)
click to toggle source
# File lib/ruby_event_store/rspec/apply.rb, line 37 def matches?(event_proc) raise_aggregate_not_set unless fetch_events.aggregate? before = fetch_events.aggregate.unpublished_events.to_a event_proc.call @applied_events = fetch_events.aggregate.unpublished_events.to_a - before MatchEvents.new.call(expected, applied_events) end
once()
click to toggle source
# File lib/ruby_event_store/rspec/apply.rb, line 32 def once expected.once self end
strict()
click to toggle source
# File lib/ruby_event_store/rspec/apply.rb, line 17 def strict expected.strict self end
supports_block_expectations?()
click to toggle source
# File lib/ruby_event_store/rspec/apply.rb, line 57 def supports_block_expectations? true end
times()
click to toggle source
# File lib/ruby_event_store/rspec/apply.rb, line 27 def times self end
Also aliased as: time
Private Instance Methods
raise_aggregate_not_set()
click to toggle source
# File lib/ruby_event_store/rspec/apply.rb, line 63 def raise_aggregate_not_set raise "You have to set the aggregate instance with `in`, e.g. `expect { ... }.to apply(an_event(MyEvent)).in(aggregate)`" end