class DataMapperTest::MachineWithValidationsAndCustomAttributeTest

Public Instance Methods

setup() click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 1057
def setup
  @resource = new_resource
  @machine = StateMachine::Machine.new(@resource, :status, :attribute => :state)
  @machine.state :parked
  
  @record = @resource.new
end
test_should_add_validation_errors_to_custom_attribute() click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 1065
def test_should_add_validation_errors_to_custom_attribute
  @record.state = 'invalid'
  
  assert !@record.valid?
  assert_equal ['is invalid'], @record.errors.on(:state)
  
  @record.state = 'parked'
  assert @record.valid?
end