Sha256: ca58ccb9810854dfd084842213b9438af9649b726260a76f15f2f91b2e820c7f
Contents?: true
Size: 901 Bytes
Versions: 3
Compression:
Stored size: 901 Bytes
Contents
require_relative '../../spec_helper' describe 'DataMapper::Validations::Fixtures::Product' do before :all do DataMapper::Validations::Fixtures::ProductCompany.auto_migrate! DataMapper::Validations::Fixtures::Product.auto_migrate! parent_model = DataMapper::Validations::Fixtures::ProductCompany @parent = parent_model.new(:title => "Apple", :flagship_product => "Macintosh") expect(@parent).to be_valid expect(@parent.save).to be_true model_model = DataMapper::Validations::Fixtures::Product @model = model_model.new(:name => "MacBook Pro", :company => @parent) expect(@model).to be_valid end describe "without company" do before :all do @model.company = nil end it_behaves_like 'invalid model' it "has a meaningful error message" do expect(@model.errors.on(:company)).to eq [ 'Company must not be blank' ] end end end
Version data entries
3 entries across 3 versions & 1 rubygems