Permalink
Browse files

Added a failing test for existing scopes that share their names with …

…column names being ignored.
  • Loading branch information...
1 parent f25e75a commit f40ec2563e71c613697c53bb4effb7ba05f60015 @laserlemon laserlemon committed with Sep 30, 2009
Showing with 9 additions and 0 deletions.
  1. +9 −0 spec/search_spec.rb
View
@@ -75,6 +75,15 @@
search.username.should be_nil
end
+ it "should use custom scopes before normalizing" do
+ User.create(:username => "bjohnson")
+ User.named_scope :username, lambda { |value| {:conditions => {:username => value.reverse}} }
+ search1 = User.search(:username => "bjohnson")
+ search2 = User.search(:username => "nosnhojb")
+ search1.count.should == 0
+ search2.count.should == 1
+ end
+
it "should ignore blank values in arrays" do
search = User.search
search.conditions = {"username_equals_any" => [""]}

0 comments on commit f40ec25

Please sign in to comment.