Sha256: e1cbf61ceee877b32534060a92fd5358a3856ae40e6c86e116fa1bc3c509c23b
Contents?: true
Size: 748 Bytes
Versions: 2
Compression:
Stored size: 748 Bytes
Contents
require "spec_helper" describe Mongoid::Criteria do describe "#each" do before :each do Person.destroy_all @person1 = Person.create(:title => "Sir", :age => 100, :aliases => ["D", "Durran"], :ssn => "666666666") @person2 = Person.create(:title => "Madam", :age => 1, :ssn => "098-76-5434") @person1.create_game(:score => 10) @person2.create_game(:score => 20) end it "without includes" do criteria = Person.all criteria.collect(&:title).should == ["Sir", "Madam"] end it "with includes" do criteria = Person.includes(:game) criteria.collect(&:title).should == ["Sir", "Madam"] criteria.collect(&:game).should == [@person1.game, @person2.game] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mongoid-eager-loading-0.1.1 | spec/mongoid-eager-loading/mongoid/criteria_spec.rb |
mongoid-eager-loading-0.1.0 | spec/mongoid-eager-loading/mongoid/criteria_spec.rb |