Class: RubyEventStore::RSpec::ExpectedCollection
- Inherits:
-
Object
- Object
- RubyEventStore::RSpec::ExpectedCollection
- Defined in:
- lib/ruby_event_store/rspec/expected_collection.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#events ⇒ Object
readonly
Returns the value of attribute events.
Instance Method Summary collapse
- #empty? ⇒ Boolean
- #event ⇒ Object
- #exactly(count) ⇒ Object
-
#initialize(events) ⇒ ExpectedCollection
constructor
A new instance of ExpectedCollection.
- #once ⇒ Object
- #specified_count? ⇒ Boolean
- #strict ⇒ Object
- #strict? ⇒ Boolean
Constructor Details
#initialize(events) ⇒ ExpectedCollection
Returns a new instance of ExpectedCollection.
4 5 6 7 |
# File 'lib/ruby_event_store/rspec/expected_collection.rb', line 4 def initialize(events) @events = events @strict = false end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
40 41 42 |
# File 'lib/ruby_event_store/rspec/expected_collection.rb', line 40 def count @count end |
#events ⇒ Object (readonly)
Returns the value of attribute events.
40 41 42 |
# File 'lib/ruby_event_store/rspec/expected_collection.rb', line 40 def events @events end |
Instance Method Details
#empty? ⇒ Boolean
15 16 17 |
# File 'lib/ruby_event_store/rspec/expected_collection.rb', line 15 def empty? events.empty? end |
#event ⇒ Object
35 36 37 38 |
# File 'lib/ruby_event_store/rspec/expected_collection.rb', line 35 def event raise NotSupported if !events.size.equal?(1) events.first end |
#exactly(count) ⇒ Object
9 10 11 12 13 |
# File 'lib/ruby_event_store/rspec/expected_collection.rb', line 9 def exactly(count) raise NotSupported if !events.size.equal?(1) raise NotSupported if count < 1 @count = count end |
#once ⇒ Object
19 20 21 |
# File 'lib/ruby_event_store/rspec/expected_collection.rb', line 19 def once exactly(1) end |
#specified_count? ⇒ Boolean
23 24 25 |
# File 'lib/ruby_event_store/rspec/expected_collection.rb', line 23 def specified_count? !count.nil? end |
#strict ⇒ Object
27 28 29 |
# File 'lib/ruby_event_store/rspec/expected_collection.rb', line 27 def strict @strict = true end |
#strict? ⇒ Boolean
31 32 33 |
# File 'lib/ruby_event_store/rspec/expected_collection.rb', line 31 def strict? @strict end |