Class: Statecraft::RSpec::HaveInitialState
- Inherits:
-
Object
- Object
- Statecraft::RSpec::HaveInitialState
- Defined in:
- lib/statecraft/rspec/have_initial_state.rb
Overview
expect(OrderFlow).to have_initial_state(:pending)
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(state_name) ⇒ HaveInitialState
constructor
A new instance of HaveInitialState.
- #matches?(machine_class) ⇒ Boolean
Constructor Details
#initialize(state_name) ⇒ HaveInitialState
Returns a new instance of HaveInitialState.
7 8 9 |
# File 'lib/statecraft/rspec/have_initial_state.rb', line 7 def initialize(state_name) @state_name = state_name.to_sym end |
Instance Method Details
#description ⇒ Object
25 26 27 |
# File 'lib/statecraft/rspec/have_initial_state.rb', line 25 def description "have the initial state #{@state_name.inspect}" end |
#failure_message ⇒ Object
16 17 18 19 |
# File 'lib/statecraft/rspec/have_initial_state.rb', line 16 def "expected the initial state of #{@machine_class.name} to be #{@state_name.inspect}, " \ "but it is #{@machine_class.initial_state.inspect}" end |
#failure_message_when_negated ⇒ Object
21 22 23 |
# File 'lib/statecraft/rspec/have_initial_state.rb', line 21 def "expected the initial state of #{@machine_class.name} not to be #{@state_name.inspect}, but it is" end |
#matches?(machine_class) ⇒ Boolean
11 12 13 14 |
# File 'lib/statecraft/rspec/have_initial_state.rb', line 11 def matches?(machine_class) @machine_class = machine_class machine_class.initial_state == @state_name end |