spec/named_scopes/conditions_spec.rb in joost-searchlogic-2.1.7.1 vs spec/named_scopes/conditions_spec.rb in joost-searchlogic-2.2.3.1
- old
+ new
@@ -47,27 +47,47 @@
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("")
end
end
@@ -181,12 +201,9 @@
it "should have not_equal_to" do
User.age_not_equal_to(5).proxy_options.should == User.age_does_not_equal(5).proxy_options
end
it "should have is_not" do
- # This is matching "not" first. How do you give priority in a regex? Because it's matching the
- # 'not' condition and thinking the column is 'age_is'.
- pending
User.age_is_not(5).proxy_options.should == User.age_does_not_equal(5).proxy_options
end
it "should have not" do
User.age_not(5).proxy_options.should == User.age_does_not_equal(5).proxy_options