spec/goldiloader/goldiloader_spec.rb in goldiloader-0.0.6 vs spec/goldiloader/goldiloader_spec.rb in goldiloader-0.0.7
- old
+ new
@@ -438,9 +438,23 @@
expect(author.association(:unique_tags_has_and_belongs)).to_not be_loaded
end
end
end
end
+
+ if ActiveRecord::VERSION::MAJOR >= 4
+ context "associations with an instance dependent scope" do
+ before do
+ blogs.first.instance_dependent_posts.to_a
+ end
+
+ it "applies the scope correctly" do
+ expect(blogs.first.instance_dependent_posts.to_a).to match_array(blogs.first.posts)
+ end
+
+ it_behaves_like "it doesn't auto eager the association", :instance_dependent_posts
+ end
+ end
end
context "associations with a uniq" do
let!(:post1) do
Post.create! { |post| post.tags << child_tag1 << child_tag1 << child_tag3 }