Class: Metacosm::TestHarness::GivenWhenThen
- Inherits:
-
Struct
- Object
- Struct
- Metacosm::TestHarness::GivenWhenThen
- Includes:
- RSpec::Matchers
- Defined in:
- lib/metacosm/support/test_harness.rb
Instance Attribute Summary collapse
-
#given_events ⇒ Object
Returns the value of attribute given_events.
-
#then_event_class ⇒ Object
Returns the value of attribute then_event_class.
-
#when_command ⇒ Object
Returns the value of attribute when_command.
Instance Method Summary collapse
- #expect_events(evts) ⇒ Object
- #expect_query(query, to_find:) ⇒ Object
- #verify! ⇒ Object protected
- #when(*commands) ⇒ Object
Instance Attribute Details
#given_events ⇒ Object
Returns the value of attribute given_events
3 4 5 |
# File 'lib/metacosm/support/test_harness.rb', line 3 def given_events @given_events end |
#then_event_class ⇒ Object
Returns the value of attribute then_event_class
3 4 5 |
# File 'lib/metacosm/support/test_harness.rb', line 3 def then_event_class @then_event_class end |
#when_command ⇒ Object
Returns the value of attribute when_command
3 4 5 |
# File 'lib/metacosm/support/test_harness.rb', line 3 def when_command @when_command end |
Instance Method Details
#expect_events(evts) ⇒ Object
14 15 16 17 18 |
# File 'lib/metacosm/support/test_harness.rb', line 14 def expect_events(evts) @then_events = evts verify! self end |
#expect_query(query, to_find:) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/metacosm/support/test_harness.rb', line 20 def expect_query(query, to_find:) @query = query @expected_query_results = to_find verify! self end |
#verify! ⇒ Object (protected)
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/metacosm/support/test_harness.rb', line 29 def verify! clean_slate! receive_events! fire_commands! validate_events! validate_query! self end |
#when(*commands) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/metacosm/support/test_harness.rb', line 6 def when(*commands) @when_commands ||= [] commands.each do |command| @when_commands.push command end self end |