spec/named_scopes/conditions_spec.rb in binarylogic-searchlogic-2.1.7 vs spec/named_scopes/conditions_spec.rb in binarylogic-searchlogic-2.1.8

- old
+ new

@@ -47,24 +47,44 @@ it "should have like" do %w(bjohnson thunt).each { |username| User.create(:username => username) } User.username_like("john").all.should == User.find_all_by_username("bjohnson") end + it "should have not like" do + %w(bjohnson thunt).each { |username| User.create(:username => username) } + User.username_not_like("john").all.should == User.find_all_by_username("thunt") + end + it "should have begins with" do %w(bjohnson thunt).each { |username| User.create(:username => username) } User.username_begins_with("bj").all.should == User.find_all_by_username("bjohnson") end + it "should have not begin with" do + %w(bjohnson thunt).each { |username| User.create(:username => username) } + User.username_not_begin_with("bj").all.should == User.find_all_by_username("thunt") + end + it "should have ends with" do %w(bjohnson thunt).each { |username| User.create(:username => username) } User.username_ends_with("son").all.should == User.find_all_by_username("bjohnson") end + + it "should have not end with" do + %w(bjohnson thunt).each { |username| User.create(:username => username) } + User.username_not_end_with("son").all.should == User.find_all_by_username("thunt") + end end context "boolean conditions" do it "should have null" do ["bjohnson", nil].each { |username| User.create(:username => username) } User.username_null.all.should == User.find_all_by_username(nil) + end + + it "should have not null" do + ["bjohnson", nil].each { |username| User.create(:username => username) } + User.username_not_null.all.should == User.find_all_by_username("bjohnson") end it "should have empty" do ["bjohnson", ""].each { |username| User.create(:username => username) } User.username_empty.all.should == User.find_all_by_username("")