class MachineWithExistingStateTest
Public Instance Methods
setup()
click to toggle source
# File test/unit/machine_test.rb, line 2163 def setup @klass = Class.new @machine = StateMachine::Machine.new(@klass) @state = @machine.state :parked @same_state = @machine.state :parked, :value => 1 end
test_should_be_able_to_look_up_state_by_new_value()
click to toggle source
# File test/unit/machine_test.rb, line 2182 def test_should_be_able_to_look_up_state_by_new_value assert_equal @state, @machine.states[1, :value] end
test_should_no_longer_be_able_to_look_up_state_by_original_value()
click to toggle source
# File test/unit/machine_test.rb, line 2178 def test_should_no_longer_be_able_to_look_up_state_by_original_value assert_nil @machine.states['parked', :value] end
test_should_not_create_a_new_state()
click to toggle source
# File test/unit/machine_test.rb, line 2170 def test_should_not_create_a_new_state assert_same @state, @same_state end
test_should_update_attributes()
click to toggle source
# File test/unit/machine_test.rb, line 2174 def test_should_update_attributes assert_equal 1, @state.value end