Permalink
Browse files

additional test to fail

  • Loading branch information...
flyerhzm committed Jan 24, 2011
1 parent 81d97cb commit d798684d639cde5aeee2cb971f4124263ba60a10
Showing with 16 additions and 0 deletions.
  1. +16 −0 spec/mongoid-eager-loading/mongoid/criterion/eager_loading_spec.rb
@@ -167,5 +167,21 @@
@post5.person.should == nil
end
end
+
+ it "preload references_many association" do
+ people = Person.all.to_a
+ posts = Post.all.to_a
+
+ criteria = Mongoid::Criteria.new(Person)
+
+ criteria.each do |person|
+ person.posts.should be_an_instance_of Array
+ person.posts.each {|p| p.should be_an_instance_of Post}
+ end
+ criteria.includes(:posts).all.each do |person|
+ person.posts.should be_an_instance_of Array
+ person.posts.each {|p| p.should be_an_instance_of Post}
+ end
+ end
end
end

0 comments on commit d798684

Please sign in to comment.