Class: RubyEventStore::RSpec::Apply
- Inherits:
-
Object
- Object
- RubyEventStore::RSpec::Apply
- Defined in:
- lib/ruby_event_store/rspec/apply.rb
Instance Method Summary collapse
- #description ⇒ Object
- #exactly(count) ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
- #in(aggregate) ⇒ Object
-
#initialize(*expected, failure_message_formatter:) ⇒ Apply
constructor
A new instance of Apply.
- #matches?(event_proc) ⇒ Boolean
- #once ⇒ Object
- #strict ⇒ Object
- #supports_block_expectations? ⇒ Boolean
- #times ⇒ Object (also: #time)
Constructor Details
#initialize(*expected, failure_message_formatter:) ⇒ Apply
Returns a new instance of Apply.
6 7 8 9 10 |
# File 'lib/ruby_event_store/rspec/apply.rb', line 6 def initialize(*expected, failure_message_formatter:) @expected = ExpectedCollection.new(expected) @failure_message_formatter = @fetch_events = FetchUnpublishedEvents.new end |
Instance Method Details
#description ⇒ Object
53 54 55 |
# File 'lib/ruby_event_store/rspec/apply.rb', line 53 def description "apply events" end |
#exactly(count) ⇒ Object
22 23 24 25 |
# File 'lib/ruby_event_store/rspec/apply.rb', line 22 def exactly(count) expected.exactly(count) self end |
#failure_message ⇒ Object
45 46 47 |
# File 'lib/ruby_event_store/rspec/apply.rb', line 45 def .(expected, applied_events) end |
#failure_message_when_negated ⇒ Object
49 50 51 |
# File 'lib/ruby_event_store/rspec/apply.rb', line 49 def .(expected, applied_events) end |
#in(aggregate) ⇒ Object
12 13 14 15 |
# File 'lib/ruby_event_store/rspec/apply.rb', line 12 def in(aggregate) fetch_events.in(aggregate) self end |
#matches?(event_proc) ⇒ Boolean
37 38 39 40 41 42 43 |
# 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 ⇒ Object
32 33 34 35 |
# File 'lib/ruby_event_store/rspec/apply.rb', line 32 def once expected.once self end |
#strict ⇒ Object
17 18 19 20 |
# File 'lib/ruby_event_store/rspec/apply.rb', line 17 def strict expected.strict self end |
#supports_block_expectations? ⇒ Boolean
57 58 59 |
# File 'lib/ruby_event_store/rspec/apply.rb', line 57 def supports_block_expectations? true end |
#times ⇒ Object Also known as: time
27 28 29 |
# File 'lib/ruby_event_store/rspec/apply.rb', line 27 def times self end |