case insensitivity on search
This commit is contained in:
parent
e9a3f46fbd
commit
08f833ba7a
2 changed files with 3 additions and 3 deletions
|
|
@ -35,7 +35,7 @@ class Person
|
|||
/^(https?):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(\.[a-z]{2,5})?(:[0-9]{1,5})?(\/.*)?$/ix
|
||||
|
||||
def self.search(query)
|
||||
Person.all('profile.first_name' => /^#{query}/) | Person.all('profile.last_name' => /^#{query}/)
|
||||
Person.all('profile.first_name' => /^#{query}/i) | Person.all('profile.last_name' => /^#{query}/i)
|
||||
end
|
||||
|
||||
def real_name
|
||||
|
|
|
|||
|
|
@ -134,13 +134,13 @@ describe Person do
|
|||
people.include?(@friend_three).should == false
|
||||
people.include?(@friend_four).should == false
|
||||
|
||||
people = Person.search("Wei")
|
||||
people = Person.search("wEi")
|
||||
people.include?(@friend_two).should == true
|
||||
people.include?(@friend_one).should == false
|
||||
people.include?(@friend_three).should == false
|
||||
people.include?(@friend_four).should == false
|
||||
|
||||
people = Person.search("Gri")
|
||||
people = Person.search("gri")
|
||||
people.include?(@friend_one).should == true
|
||||
people.include?(@friend_four).should == true
|
||||
people.include?(@friend_two).should == false
|
||||
|
|
|
|||
Loading…
Reference in a new issue