class EventTest
Public Instance Methods
setup()
click to toggle source
# File test/unit/event_test.rb, line 62 def setup @machine = StateMachine::Machine.new(Class.new) @machine.events << @event = StateMachine::Event.new(@machine, :ignite) @event.transition :parked => :idling end
test_should_allow_changing_human_name()
click to toggle source
# File test/unit/event_test.rb, line 74 def test_should_allow_changing_human_name @event.human_name = 'Stop' assert_equal 'Stop', @event.human_name end
test_should_allow_changing_machine()
click to toggle source
# File test/unit/event_test.rb, line 68 def test_should_allow_changing_machine new_machine = StateMachine::Machine.new(Class.new) @event.machine = new_machine assert_equal new_machine, @event.machine end
test_should_provide_matcher_helpers_during_initialization()
click to toggle source
# File test/unit/event_test.rb, line 79 def test_should_provide_matcher_helpers_during_initialization matchers = [] @event.instance_eval do matchers = [all, any, same] end assert_equal [StateMachine::AllMatcher.instance, StateMachine::AllMatcher.instance, StateMachine::LoopbackMatcher.instance], matchers end
test_should_use_pretty_inspect()
click to toggle source
# File test/unit/event_test.rb, line 89 def test_should_use_pretty_inspect assert_match "#<StateMachine::Event name=:ignite transitions=[:parked => :idling]>", @event.inspect end