Remove expectation of term case

This commit is contained in:
Mike Moore 2013-02-07 05:59:25 -05:00
parent 5b01ac9288
commit e41b6537f9
3 changed files with 12 additions and 2 deletions

View File

@ -288,7 +288,7 @@ class UsersController < ApplicationController
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

View File

@ -14,7 +14,7 @@ class UserSearch
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(

View File

@ -59,6 +59,16 @@ describe UsersController, :search_users do
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