class StateTest
Public Instance Methods
setup()
click to toggle source
# File test/unit/state_test.rb, line 44 def setup @machine = StateMachine::Machine.new(Class.new) @machine.states << @state = StateMachine::State.new(@machine, :parked) end
test_should_allow_changing_human_name()
click to toggle source
# File test/unit/state_test.rb, line 76 def test_should_allow_changing_human_name @state.human_name = 'stopped' assert_equal 'stopped', @state.human_name end
test_should_allow_changing_initial()
click to toggle source
# File test/unit/state_test.rb, line 65 def test_should_allow_changing_initial @state.initial = true assert @state.initial end
test_should_allow_changing_machine()
click to toggle source
# File test/unit/state_test.rb, line 54 def test_should_allow_changing_machine new_machine = StateMachine::Machine.new(Class.new) @state.machine = new_machine assert_equal new_machine, @state.machine end
test_should_allow_changing_matcher()
click to toggle source
# File test/unit/state_test.rb, line 70 def test_should_allow_changing_matcher matcher = lambda {} @state.matcher = matcher assert_equal matcher, @state.matcher end
test_should_allow_changing_value()
click to toggle source
# File test/unit/state_test.rb, line 60 def test_should_allow_changing_value @state.value = 1 assert_equal 1, @state.value end
test_should_raise_exception_if_invalid_option_specified()
click to toggle source
# File test/unit/state_test.rb, line 49 def test_should_raise_exception_if_invalid_option_specified exception = assert_raise(ArgumentError) {StateMachine::State.new(@machine, :parked, :invalid => true)} assert_equal 'Invalid key(s): invalid', exception.message end
test_should_use_pretty_inspect()
click to toggle source
# File test/unit/state_test.rb, line 81 def test_should_use_pretty_inspect assert_equal '#<StateMachine::State name=:parked value="parked" initial=false context=[]>', @state.inspect end