Sha256: 9bfc5177a688d0a758778a5959e93cc9f3cf333476c25cc9988a9457476518a6
Contents?: true
Size: 1.36 KB
Versions: 2
Compression:
Stored size: 1.36 KB
Contents
require_relative '../../spec_helper' # TODO: combine this into one_to_one_spec.rb describe 'One to One Associations when foreign key is part of a composite key and contains a boolean, with an integer and a boolean making up the composite key' do before :all do class ::ParentModel include DataMapper::Resource property :integer_key, Integer, :key => true property :boolean_key, Boolean, :key => true has 1, :child_model, :child_key => [ :integer_key, :boolean_key ] end class ::ChildModel include DataMapper::Resource property :integer_key, Integer, :key => true property :other_integer_key, Integer, :key => true property :boolean_key, Boolean, :key => true belongs_to :parent_model, :child_key => [ :integer_key, :boolean_key ] end DataMapper.finalize end supported_by :all do before :all do @parent = ParentModel.create(:integer_key => 1, :boolean_key => false) @child = ChildModel.create(:integer_key => 1, :other_integer_key => 1, :boolean_key => false) end it 'is able to access the child' do expect(@parent.child_model).to eq @child end it 'is able to access the parent' do expect(@child.parent_model).to eq @parent end it 'is able to access the parent_key' do expect(@child.parent_model.key).not_to be_nil end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sbf-dm-core-1.3.0 | spec/public/associations/one_to_one_with_boolean_cpk_spec.rb |
sbf-dm-core-1.3.0.beta | spec/public/associations/one_to_one_with_boolean_cpk_spec.rb |