spec/named_scopes/conditions_spec.rb in binarylogic-searchlogic-2.3.0 vs spec/named_scopes/conditions_spec.rb in binarylogic-searchlogic-2.3.1

- old
+ new

@@ -91,14 +91,29 @@ it "should have empty" do ["bjohnson", ""].each { |username| User.create(:username => username) } User.username_empty.all.should == User.find_all_by_username("") end + + it "should have blank" do + ["bjohnson", "", nil].each { |username| User.create(:username => username) } + User.username_blank.all.should == User.all(:conditions => "username IS NULL OR username = ''") + end + + it "should have not blank" do + ["bjohnson", "", nil].each { |username| User.create(:username => username) } + User.username_not_blank.all.should == User.all(:conditions => "username IS NOT NULL OR username != ''") + end end context "any and all conditions" do it "should do nothing if no arguments are passed" do User.username_equals_any.proxy_options.should == {} + end + + it "should treat an array and multiple arguments the same" do + %w(bjohnson thunt dgainor).each { |username| User.create(:username => username) } + User.username_like_any("bjohnson", "thunt").should == User.username_like_any(["bjohnson", "thunt"]) end it "should have equals any" do %w(bjohnson thunt dgainor).each { |username| User.create(:username => username) } User.username_equals_any("bjohnson", "thunt").all == User.find_all_by_username(["bjohnson", "thunt"])