Sha256: 770ad4f8a4652873fb4c06898abe11ecf273d6527d336fdbe1483e0add0ae9bc
Contents?: true
Size: 1.43 KB
Versions: 2
Compression:
Stored size: 1.43 KB
Contents
require_relative '../../../spec_helper' describe 'Many to Many Associations read across multiple join associations' do before :all do class ::User include DataMapper::Resource property :id, Serial has n, :sales has n, :sale_items, :through => :sales has n, :items, :through => :sale_items end class ::Sale include DataMapper::Resource property :id, Serial belongs_to :user has n, :sale_items has n, :items, :through => :sale_items end class ::SaleItem include DataMapper::Resource property :id, Serial belongs_to :sale belongs_to :item end class ::Item include DataMapper::Resource property :id, Serial has n, :sale_items end DataMapper.finalize end supported_by :all do before :all do @user = User.create @sale = @user.sales.create 5.times { @sale.items.create } end before :all do @no_join = (defined?(DataMapper::Adapters::InMemoryAdapter) && @adapter.is_a?(DataMapper::Adapters::InMemoryAdapter)) || (defined?(DataMapper::Adapters::YamlAdapter) && @adapter.is_a?(DataMapper::Adapters::YamlAdapter)) @skip = @no_join end before do pending if @skip end it 'returns all the created entries' do expect(@user.items.to_a).to eq Item.all.to_a expect(@sale.items.to_a).to eq Item.all.to_a end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sbf-dm-core-1.3.0 | spec/public/associations/many_to_many/read_multiple_join_spec.rb |
sbf-dm-core-1.3.0.beta | spec/public/associations/many_to_many/read_multiple_join_spec.rb |