Permalink
Browse files

Remove expectation of term case

  • Loading branch information...
1 parent 5b01ac9 commit e41b6537f94805d778d9420a66fe15dd34d8d319 @blowmage committed Feb 7, 2013
@@ -288,7 +288,7 @@ def activate_account
end
def search_users
- term = (params[:term] || "").strip.downcase
+ term = params[:term].to_s.strip
topic_id = params[:topic_id]
topic_id = topic_id.to_i if topic_id
@@ -14,7 +14,7 @@ def self.sql term, topic_id
end
if term.length > 0
- sql << "where username_lower like :term_like or
+ sql << "where username ilike :term_like or
to_tsvector('simple', name) @@
to_tsquery('simple',
regexp_replace(
@@ -59,6 +59,16 @@
json = JSON.parse(response.body)
json["users"].size.should == 3
end
+
+ it "searches the user's username substring upper case" do
+ xhr :post, :search_users, term: "MR"
+ json = JSON.parse(response.body)
+ json["users"].size.should == 6
+
+ xhr :post, :search_users, term: "MRB"
+ json = JSON.parse(response.body)
+ json["users"].size.should == 3
+ end
end
context "sort order respects users with posts on the topic" do

0 comments on commit e41b653

Please sign in to comment.