class AttributeTransitionCollectionWithAroundCallbackAfterYieldHaltTest

Public Instance Methods

setup() click to toggle source
# File test/unit/transition_collection_test.rb, line 1974
def setup
  @klass = Class.new
  
  @machine = StateMachine::Machine.new(@klass, :initial => :parked, :action => :save)
  @machine.state :idling
  @machine.event :ignite
  
  @machine.around_transition {|block| block.call; throw :halt}
  
  @object = @klass.new
  @object.state_event = 'ignite'
  
  @transitions = StateMachine::AttributeTransitionCollection.new([
    StateMachine::Transition.new(@object, @machine, :ignite, :parked, :idling)
  ])
  @result = @transitions.perform
end
test_should_clear_event() click to toggle source
# File test/unit/transition_collection_test.rb, line 1996
def test_should_clear_event
  assert_nil @object.state_event
end
test_should_not_write_event_transition() click to toggle source
# File test/unit/transition_collection_test.rb, line 2000
def test_should_not_write_event_transition
  assert_nil @object.send(:state_event_transition)
end
test_should_succeed() click to toggle source
# File test/unit/transition_collection_test.rb, line 1992
def test_should_succeed
  assert_equal true, @result
end