Sha256: 13ea9c757135e0eec5e729ce884d9b99b98a48b2ed1b6ba22aeb63e3f864b5d1

Contents?: true

Size: 771 Bytes

Versions: 1

Compression:

Stored size: 771 Bytes

Contents

require 'spec_helper'

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

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

    @model  = DataMapper::Validate::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

1 entries across 1 versions & 1 rubygems

Version Path
dm-validations-0.10.2 spec/integration/datamapper_models/association_validation_spec.rb