class TransitionWithoutRunningActionTest
Public Instance Methods
save()
click to toggle source
# File test/unit/transition_test.rb, line 1391 def save @saved = true end
setup()
click to toggle source
# File test/unit/transition_test.rb, line 1387 def setup @klass = Class.new do attr_reader :saved def save @saved = true end end @machine = StateMachine::Machine.new(@klass, :action => :save) @machine.state :parked, :idling @machine.event :ignite @machine.after_transition {|object| @run_after = true} @object = @klass.new @object.state = 'parked' @transition = StateMachine::Transition.new(@object, @machine, :ignite, :parked, :idling) @result = @transition.perform(false) end
test_should_be_successful()
click to toggle source
# File test/unit/transition_test.rb, line 1415 def test_should_be_successful assert_equal true, @result end
test_should_change_the_current_state()
click to toggle source
# File test/unit/transition_test.rb, line 1419 def test_should_change_the_current_state assert_equal 'idling', @object.state end
test_should_have_empty_args()
click to toggle source
# File test/unit/transition_test.rb, line 1407 def test_should_have_empty_args assert_equal [], @transition.args end
test_should_not_have_a_result()
click to toggle source
# File test/unit/transition_test.rb, line 1411 def test_should_not_have_a_result assert_nil @transition.result end
test_should_not_run_the_action()
click to toggle source
# File test/unit/transition_test.rb, line 1423 def test_should_not_run_the_action assert !@object.saved end
test_should_run_after_callbacks()
click to toggle source
# File test/unit/transition_test.rb, line 1427 def test_should_run_after_callbacks assert @run_after end