class EventWithDynamicHumanNameTest
Public Instance Methods
setup()
click to toggle source
# File test/unit/event_test.rb, line 107 def setup @klass = Class.new @machine = StateMachine::Machine.new(@klass) @machine.events << @event = StateMachine::Event.new(@machine, :ignite, :human_name => lambda {|event, object| ['start', object]}) end
test_should_allow_custom_class_to_be_passed_through()
click to toggle source
# File test/unit/event_test.rb, line 119 def test_should_allow_custom_class_to_be_passed_through human_name, klass = @event.human_name(1) assert_equal 'start', human_name assert_equal 1, klass end
test_should_not_cache_value()
click to toggle source
# File test/unit/event_test.rb, line 125 def test_should_not_cache_value assert_not_same @event.human_name, @event.human_name end
test_should_use_custom_human_name()
click to toggle source
# File test/unit/event_test.rb, line 113 def test_should_use_custom_human_name human_name, klass = @event.human_name assert_equal 'start', human_name assert_equal @klass, klass end