class EventCollectionWithMultipleEventsTest
Public Instance Methods
setup()
click to toggle source
# File test/unit/event_collection_test.rb, line 128 def setup @klass = Class.new @machine = StateMachine::Machine.new(@klass, :initial => :parked) @events = StateMachine::EventCollection.new(@machine) @machine.state :first_gear @park, @shift_down = @machine.event :park, :shift_down @events << @park @park.transition :first_gear => :parked @events << @shift_down @shift_down.transition :first_gear => :parked @machine.events.concat(@events) end
test_should_only_include_all_valid_events_for_an_object()
click to toggle source
# File test/unit/event_collection_test.rb, line 145 def test_should_only_include_all_valid_events_for_an_object object = @klass.new object.state = 'first_gear' assert_equal [@park, @shift_down], @events.valid_for(object) end