spec/search_spec.rb in searchlogic-2.4.3 vs spec/search_spec.rb in searchlogic-2.4.4
- old
+ new
@@ -67,24 +67,30 @@
search = User.search
search.conditions = {"username" => "bjohnson"}
search.username.should == "bjohnson"
end
+ it "should use custom scopes before normalizing" do
+ User.create(:username => "bjohnson")
+ User.named_scope :username, lambda { |value| {:conditions => {:username => value.reverse}} }
+ search1 = User.search(:username => "bjohnson")
+ search2 = User.search(:username => "nosnhojb")
+ search1.count.should == 0
+ search2.count.should == 1
+ end
+
# We ignore them upon execution. But we still want to accept the condition so that returning the conditions
# preserves the values.
it "should not ignore blank values" do
search = User.search
search.conditions = {"username" => ""}
search.username.should == ""
end
- it "should use custom scopes before normalizing" do
- User.create(:username => "bjohnson")
- User.named_scope :username, lambda { |value| {:conditions => {:username => value.reverse}} }
- search1 = User.search(:username => "bjohnson")
- search2 = User.search(:username => "nosnhojb")
- search1.count.should == 0
- search2.count.should == 1
+ it "should not ignore blank values and should not cast them" do
+ search = User.search
+ search.conditions = {"id_equals" => ""}
+ search.id_equals.should == ""
end
it "should ignore blank values in arrays" do
search = User.search
search.conditions = {"username_equals_any" => [""]}