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.
6 7 8 9 |
# File 'lib/ruby_event_store/rspec/expected_collection.rb', line 6 def initialize(events) @events = events @strict = false end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
42 43 44 |
# File 'lib/ruby_event_store/rspec/expected_collection.rb', line 42 def count @count end |
#events ⇒ Object (readonly)
Returns the value of attribute events.
42 43 44 |
# File 'lib/ruby_event_store/rspec/expected_collection.rb', line 42 def events @events end |
Instance Method Details
#empty? ⇒ Boolean
17 18 19 |
# File 'lib/ruby_event_store/rspec/expected_collection.rb', line 17 def empty? events.empty? end |
#event ⇒ Object
37 38 39 40 |
# File 'lib/ruby_event_store/rspec/expected_collection.rb', line 37 def event raise NotSupported if !events.size.equal?(1) events.first end |
#exactly(count) ⇒ Object
11 12 13 14 15 |
# File 'lib/ruby_event_store/rspec/expected_collection.rb', line 11 def exactly(count) raise NotSupported if !events.size.equal?(1) raise NotSupported if count < 1 @count = count end |
#once ⇒ Object
21 22 23 |
# File 'lib/ruby_event_store/rspec/expected_collection.rb', line 21 def once exactly(1) end |
#specified_count? ⇒ Boolean
25 26 27 |
# File 'lib/ruby_event_store/rspec/expected_collection.rb', line 25 def specified_count? !count.nil? end |
#strict ⇒ Object
29 30 31 |
# File 'lib/ruby_event_store/rspec/expected_collection.rb', line 29 def strict @strict = true end |
#strict? ⇒ Boolean
33 34 35 |
# File 'lib/ruby_event_store/rspec/expected_collection.rb', line 33 def strict? @strict end |