Class: Statecraft::RSpec::HaveTransitionedTo
- Inherits:
-
Object
- Object
- Statecraft::RSpec::HaveTransitionedTo
- Defined in:
- lib/statecraft/rspec/have_transitioned_to.rb
Overview
expect(record).to have_transitioned_to(:paid)
Strictly log-based, like transitioned_to? itself: the question is about history, never about the current state. The failure message shows what the log actually holds.
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(state_name) ⇒ HaveTransitionedTo
constructor
A new instance of HaveTransitionedTo.
- #matches?(record) ⇒ Boolean
Constructor Details
#initialize(state_name) ⇒ HaveTransitionedTo
Returns a new instance of HaveTransitionedTo.
11 12 13 |
# File 'lib/statecraft/rspec/have_transitioned_to.rb', line 11 def initialize(state_name) @state_name = state_name.to_sym end |
Instance Method Details
#description ⇒ Object
30 31 32 |
# File 'lib/statecraft/rspec/have_transitioned_to.rb', line 30 def description "have transitioned to #{@state_name.inspect}" end |
#failure_message ⇒ Object
20 21 22 23 |
# File 'lib/statecraft/rspec/have_transitioned_to.rb', line 20 def "expected the log of #{StateReport.standing(@record)} to hold a transition to #{@state_name.inspect}, " \ "but #{log_contents}" end |
#failure_message_when_negated ⇒ Object
25 26 27 28 |
# File 'lib/statecraft/rspec/have_transitioned_to.rb', line 25 def "expected the log of #{StateReport.standing(@record)} to hold no transition to #{@state_name.inspect}, " \ "but it does" end |
#matches?(record) ⇒ Boolean
15 16 17 18 |
# File 'lib/statecraft/rspec/have_transitioned_to.rb', line 15 def matches?(record) @record = record record.transitioned_to?(@state_name) end |