Sha256: 1c0c34d3dbbdb75cc8b9f76279ad6eef74d81f4e9cfb29bc17e0996d1829b804
Contents?: true
Size: 910 Bytes
Versions: 1
Compression:
Stored size: 910 Bytes
Contents
require 'spec_helper' describe EdgeRider::PreloadAssociations do describe '.preload_associations' do it 'should preload the given named associations so they are no longer fetched lazily' do forum = Forum.create! topic = Topic.create!(forum: forum) post = Post.create!(topic: topic) Forum.preload_associations([forum], topics: :posts) Topic.should_not_receive(:new) Post.should_not_receive(:new) forum.topics.collect(&:posts) end end describe '#preload_associations' do it 'should preload the given named associations so they are no longer fetched lazily' do forum = Forum.create! topic = Topic.create!(forum: forum) post = Post.create!(topic: topic) forum.preload_associations(topics: :posts) Topic.should_not_receive(:new) Post.should_not_receive(:new) forum.topics.collect(&:posts) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
edge_rider-1.1.0 | spec/edge_rider/preload_associations_spec.rb |