spec/search_spec.rb in searchlogic-2.4.5 vs spec/search_spec.rb in searchlogic-2.4.6

- old
+ new

@@ -78,26 +78,31 @@ 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 + it "should ignore blank values but still return on conditions" do search = User.search search.conditions = {"username" => ""} - search.username.should == "" + search.username.should be_nil + search.conditions.should == {:username => ""} end it "should not ignore blank values and should not cast them" do search = User.search search.conditions = {"id_equals" => ""} - search.id_equals.should == "" + search.id_equals.should be_nil + search.conditions.should == {:id_equals => ""} end it "should ignore blank values in arrays" do search = User.search search.conditions = {"username_equals_any" => [""]} - search.username_equals_any.first.should be_blank + search.username_equals_any.should be_nil + + search.conditions = {"id_equals_any" => ["", "1"]} + search.id_equals_any.should == [1] end end context "condition accessors" do it "should allow setting exact columns individually" do @@ -372,27 +377,9 @@ it "should not split out dates or times (big fix)" do s = User.search s.created_at_after = Time.now lambda { s.count }.should_not raise_error - end - - it "should ignore blank values" do - search = User.search - search.conditions = {"username_equals" => ""} - search.proxy_options.should == {} - end - - it "should not ignore blank values when explicitly set" do - search = User.search - search.username_equals = "" - search.proxy_options.should == {:conditions => ["users.username = ?", ""]} - end - - it "should ignore blank values in arrays" do - search = User.search - search.conditions = {"username_equals_any" => [""]} - search.proxy_options.should == {} end end context "method delegation" do it "should respond to count" do