class ActiveRecordTest::MachineWithDirtyAttributeAndStateEventsTest
Public Instance Methods
setup()
click to toggle source
# File test/unit/integrations/active_record_test.rb, line 724 def setup @model = new_model @machine = StateMachine::Machine.new(@model, :initial => :parked) @machine.event :ignite @record = @model.create @record.state_event = 'ignite' end
test_should_include_state_in_changed_attributes()
click to toggle source
# File test/unit/integrations/active_record_test.rb, line 733 def test_should_include_state_in_changed_attributes assert_equal %w(state), @record.changed end
test_should_not_include_state_in_changed_attributes_if_nil()
click to toggle source
# File test/unit/integrations/active_record_test.rb, line 746 def test_should_not_include_state_in_changed_attributes_if_nil @record = @model.create @record.state_event = nil assert_equal [], @record.changed end
test_should_not_reset_changes_on_multiple_changes()
click to toggle source
# File test/unit/integrations/active_record_test.rb, line 741 def test_should_not_reset_changes_on_multiple_changes @record.state_event = 'ignite' assert_equal %w(parked parked), @record.changes['state'] end
test_should_track_attribute_change()
click to toggle source
# File test/unit/integrations/active_record_test.rb, line 737 def test_should_track_attribute_change assert_equal %w(parked parked), @record.changes['state'] end