spec/mebla/searching_spec.rb in mebla-1.1.4 vs spec/mebla/searching_spec.rb in mebla-1.1.5

- old
+ new

@@ -8,11 +8,11 @@ end it "should search and return the only relevant result" do results=MongoidAlpha.search "name: Testing index" - results.count.should == 1 + results.total.should == 1 end it "should search and return the only relevant result, and cast it into the correct class type" do results=MongoidAlpha.search "name: Testing index" @@ -32,11 +32,11 @@ end it "should search within arrays" do results = MongoidZeta.search "item2" - results.count.should == 1 + results.total.should == 1 end end describe "documents with indexed methods" do before(:each) do @@ -45,11 +45,11 @@ end it "should search within indexed methods" do results = MongoidPi.search "returns smth" - results.count.should == 1 + results.total.should == 1 end end describe "documents with indexed relation fields" do before(:each) do @@ -60,11 +60,11 @@ end it "should search within indexed fields from the relations" do results = MongoidEpsilon.search "Testing index" - results.count.should == 1 + results.total.should == 1 end end describe "multiple types" do before(:each) do @@ -72,18 +72,18 @@ end it "should search and return all results of all class types" do results=Mebla.search "name: Testing index" - results.count.should == 2 + results.total.should == 2 (results.each.collect{|e| e.class} & [MongoidAlpha, MongoidBeta]).should =~ [MongoidAlpha, MongoidBeta] end it "should search and return only results from the searched class type" do results=MongoidAlpha.search "name: Testing index" - results.count.should == 1 + results.total.should == 1 results.first.class.should == MongoidAlpha end end describe "embedded documents" do @@ -93,11 +93,11 @@ end it "should search and return the only relevant result" do results=MongoidGamma.search "name: Embedded" - results.count.should == 1 + results.total.should == 1 end it "should search and return the only relevant result, and cast it into the correct class type" do results=MongoidGamma.search "name: Embedded" @@ -118,18 +118,18 @@ it "should sort ascending according to the criteria defined" do Mebla.search("Testing index").asc(:value).first.class.should == MongoidAlpha end it "should search and only return results matching the term defined" do - Mebla.search.term(:name, "index").count.should == 2 + Mebla.search.term(:name, "index").total.should == 2 end it "should search and only return results matching the terms defined" do - Mebla.search.terms(:name, ["index", "map"]).count.should == 3 + Mebla.search.terms(:name, ["index", "map"]).total.should == 3 end it "should search and filter results according to the filters defined" do - Mebla.search.terms(:name, ["index", "map"]).only(:value => [1]).count.should == 1 + Mebla.search.terms(:name, ["index", "map"]).only(:value => [1]).total.should == 1 end it "should search and return results along with facets" do results = Mebla.search.terms(:name, ["index", "map"]).facet("values", :value) results.facets["values"]["terms"].count.should == 2 \ No newline at end of file