class EventWithoutMatchingTransitionsTest
Public Instance Methods
setup()
click to toggle source
# File test/unit/event_test.rb, line 483 def setup @klass = Class.new @machine = StateMachine::Machine.new(@klass) @machine.state :parked, :idling @machine.events << @event = StateMachine::Event.new(@machine, :ignite) @event.transition(:parked => :idling) @object = @klass.new @object.state = 'idling' end
test_should_be_able_to_fire_with_custom_from_state()
click to toggle source
# File test/unit/event_test.rb, line 499 def test_should_be_able_to_fire_with_custom_from_state assert @event.can_fire?(@object, :from => :parked) end
test_should_have_a_transition_with_custom_from_state()
click to toggle source
# File test/unit/event_test.rb, line 507 def test_should_have_a_transition_with_custom_from_state assert_not_nil @event.transition_for(@object, :from => :parked) end
test_should_not_be_able_to_fire()
click to toggle source
# File test/unit/event_test.rb, line 495 def test_should_not_be_able_to_fire assert !@event.can_fire?(@object) end
test_should_not_change_the_current_state()
click to toggle source
# File test/unit/event_test.rb, line 515 def test_should_not_change_the_current_state @event.fire(@object) assert_equal 'idling', @object.state end
test_should_not_fire()
click to toggle source
# File test/unit/event_test.rb, line 511 def test_should_not_fire assert !@event.fire(@object) end
test_should_not_have_a_transition()
click to toggle source
# File test/unit/event_test.rb, line 503 def test_should_not_have_a_transition assert_nil @event.transition_for(@object) end