class DataMapperTest::MachineWithEventAttributesOnCustomActionTest

Public Instance Methods

persist() click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 1456
def persist
  save
end
setup() click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 1454
def setup
  @superclass = new_resource do
    def persist
      save
    end
  end
  @resource = Class.new(@superclass)
  @machine = StateMachine::Machine.new(@resource, :action => :persist)
  @machine.event :ignite do
    transition :parked => :idling
  end
  
  @record = @resource.new
  @record.state = 'parked'
  @record.state_event = 'ignite'
end
test_should_not_transition_on_save() click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 1476
def test_should_not_transition_on_save
  @record.save
  assert_equal 'parked', @record.state
end
test_should_not_transition_on_valid?() click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 1471
def test_should_not_transition_on_valid?
  @record.valid?
  assert_equal 'parked', @record.state
end
test_should_transition_on_custom_action() click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 1481
def test_should_transition_on_custom_action
  @record.persist
  assert_equal 'idling', @record.state
end