spec/integration/mongoid/criteria_spec.rb in mongoid-pre-2.0.0.beta1 vs spec/integration/mongoid/criteria_spec.rb in mongoid-pre-2.0.0.pre

- old
+ new

@@ -8,31 +8,10 @@ after do Person.delete_all end - describe "#avg" do - - context "without results" do - it "should return nil" do - Person.avg(:age).should == nil - end - end - - context "with results" do - before do - 10.times do |n| - Person.create(:title => "Sir", :age => ((n + 1) * 10), :aliases => ["D", "Durran"], :ssn => "#{n}") - end - end - - it "provides min for the field provided" do - Person.avg(:age).should == 55 - end - end - end - describe "#excludes" do before do @person = Person.create(:title => "Sir", :age => 100, :aliases => ["D", "Durran"], :ssn => "666666666") end @@ -69,37 +48,10 @@ criteria.should_not be_empty end end end - describe "#in" do - - context "when searching nil values" do - - before do - @person = Person.create(:title => nil) - end - - it "returns the correct document" do - from_db = Person.any_in(:title => [ true, false, nil ]).first - from_db.should == @person - end - end - - context "when searching false values" do - - before do - @person = Person.create(:terms => false) - end - - it "returns the correct document" do - from_db = Person.criteria.in(:terms => [ true, false, nil ]).first - from_db.should == @person - end - end - end - describe "#max" do context "without results" do it "should return nil" do Person.max(:age).should == nil @@ -115,10 +67,11 @@ it "provides max for the field provided" do Person.max(:age).should == 90.0 end end + end describe "#min" do context "without results" do @@ -261,12 +214,12 @@ end end it "iterates over the cursor only once" do criteria = Person.where(:title => "Sir").cache - criteria.collect.to_a.size.should == 10 + criteria.collect.size.should == 10 # Do it again! - criteria.collect.to_a.size.should == 10 + criteria.collect.size.should == 10 end end end