class EventCollectionWithCustomMachineAttributeTest
Public Instance Methods
save()
click to toggle source
# File test/unit/event_collection_test.rb, line 337 def save end
setup()
click to toggle source
# File test/unit/event_collection_test.rb, line 335 def setup @klass = Class.new do def save end end @machine = StateMachine::Machine.new(@klass, :state, :attribute => :state_id, :initial => :parked, :action => :save) @events = StateMachine::EventCollection.new(@machine) @machine.state :parked, :idling @events << @ignite = StateMachine::Event.new(@machine, :ignite) @machine.events.concat(@events) @object = @klass.new end
test_should_have_valid_transition_if_event_can_be_fired()
click to toggle source
# File test/unit/event_collection_test.rb, line 356 def test_should_have_valid_transition_if_event_can_be_fired @ignite.transition :parked => :idling @object.state_event = 'ignite' assert_instance_of StateMachine::Transition, @events.attribute_transition_for(@object) end
test_should_not_have_transition_if_nil()
click to toggle source
# File test/unit/event_collection_test.rb, line 351 def test_should_not_have_transition_if_nil @object.state_event = nil assert_nil @events.attribute_transition_for(@object) end