Sha256: 2922b9941942df95f78de397ed2a4cee440d467e4013b927850754cadd2c7c14

Contents?: true

Size: 786 Bytes

Versions: 10

Compression:

Stored size: 786 Bytes

Contents

require 'spec_helper'

describe 'DataMapper::Validations::Fixtures::Product' do
  before :all do
    DataMapper::Validations::Fixtures::ProductCompany.auto_migrate!
    DataMapper::Validations::Fixtures::Product.auto_migrate!

    @parent = DataMapper::Validations::Fixtures::ProductCompany.create(:title => "Apple", :flagship_product => "Macintosh")
    @parent.should be_valid

    @model  = DataMapper::Validations::Fixtures::Product.new(:name => "MacBook Pro", :company => @parent)
    @model.should be_valid
  end

  describe "without company" do
    before :all do
      @model.company = nil
    end

    it_should_behave_like "invalid model"

    it "has a meaningful error message" do
      @model.errors.on(:company).should == [ 'Company must not be blank' ]
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
dm-validations-1.1.0 spec/integration/datamapper_models/association_validation_spec.rb
dm-validations-1.1.0.rc3 spec/integration/datamapper_models/association_validation_spec.rb
dm-validations-1.1.0.rc2 spec/integration/datamapper_models/association_validation_spec.rb
dm-validations-1.1.0.rc1 spec/integration/datamapper_models/association_validation_spec.rb
dm-validations-1.0.2 spec/integration/datamapper_models/association_validation_spec.rb
dm-validations-1.0.1 spec/integration/datamapper_models/association_validation_spec.rb
dm-validations-1.0.0 spec/integration/datamapper_models/association_validation_spec.rb
dm-validations-1.0.0.rc3 spec/integration/datamapper_models/association_validation_spec.rb
dm-validations-1.0.0.rc2 spec/integration/datamapper_models/association_validation_spec.rb
dm-validations-1.0.0.rc1 spec/integration/datamapper_models/association_validation_spec.rb