class TransitionAfterBeingPerformedTest
Public Instance Methods
save()
click to toggle source
# File test/unit/transition_test.rb, line 1310 def save @save_state = state @saved = true 1 end
setup()
click to toggle source
# File test/unit/transition_test.rb, line 1306 def setup @klass = Class.new do attr_reader :saved, :save_state def save @save_state = state @saved = true 1 end end @machine = StateMachine::Machine.new(@klass, :action => :save) @machine.state :parked, :idling @machine.event :ignite @object = @klass.new @object.state = 'parked' @transition = StateMachine::Transition.new(@object, @machine, :ignite, :parked, :idling) @result = @transition.perform end
test_should_be_successful()
click to toggle source
# File test/unit/transition_test.rb, line 1335 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 1339 def test_should_change_the_current_state assert_equal 'idling', @object.state end
test_should_have_a_result()
click to toggle source
# File test/unit/transition_test.rb, line 1331 def test_should_have_a_result assert_equal 1, @transition.result end
test_should_have_empty_args()
click to toggle source
# File test/unit/transition_test.rb, line 1327 def test_should_have_empty_args assert_equal [], @transition.args end
test_should_run_the_action()
click to toggle source
# File test/unit/transition_test.rb, line 1343 def test_should_run_the_action assert @object.saved end
test_should_run_the_action_after_saving_the_state()
click to toggle source
# File test/unit/transition_test.rb, line 1347 def test_should_run_the_action_after_saving_the_state assert_equal 'idling', @object.save_state end