spec/search_spec.rb in searchlogic-2.3.6 vs spec/search_spec.rb in searchlogic-2.3.7
- old
+ new
@@ -3,15 +3,15 @@
describe "Search" do
context "implementation" do
it "should create a search proxy" do
User.search(:username => "joe").should be_kind_of(Searchlogic::Search)
end
-
+
it "should create a search proxy using the same class" do
User.search.klass.should == User
end
-
+
it "should pass on the current scope to the proxy" do
company = Company.create
user = company.users.create
search = company.users.search
search.current_scope.should == company.users.scope(:find)
@@ -110,16 +110,10 @@
search = User.search
search.username_equals("bjohnson").age_gt(10)
search.all.should == [user]
end
- it "should allow chaining conditions with n-depth associations" do
- search = User.search
- search.company_conglomerate_name_or_company_conglomerate_description_like("ben")
- search.proxy_options.should == User.company_conglomerate_name_or_company_conglomerate_description_like("ben").proxy_options
- end
-
it "should allow setting association conditions" do
search = User.search
search.orders_total_gt = 10
search.orders_total_gt.should == 10
end
@@ -334,9 +328,13 @@
User.search(:username_nil => true).proxy_options.should == User.username_nil.proxy_options
end
it "should ignore conditions with a value of false where the named scope has an arity of 0" do
User.search(:username_nil => false).proxy_options.should == {}
+ end
+
+ it "should not ignore conditions with a value of false where the named scope does not have an arity of 0" do
+ User.search(:username_is => false).proxy_options.should == User.username_is(false).proxy_options
end
it "should recognize the order condition" do
User.search(:order => "ascend_by_username").proxy_options.should == User.ascend_by_username.proxy_options
end