Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorMarin Jankovski <marin@gitlab.com>2014-03-26 15:44:00 +0400
committerMarin Jankovski <marin@gitlab.com>2014-03-26 15:44:00 +0400
commit961d87937b55535ff3ffd041dbc78af82d644daa (patch)
tree896688ce979d37b00c4937f02add8c023a22033a /spec
parent2e94f0d224b8e994adc2ac7868fa6ec5c5c9264a (diff)
Add the tests for user search.
Diffstat (limited to 'spec')
-rw-r--r--spec/models/user_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index fd8d7133ae9..cb0bf9ba517 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -292,6 +292,18 @@ describe User do
end
end
+ describe 'search' do
+ let(:user1) { create(:user, username: 'James', email: 'james@testing.com') }
+ let(:user2) { create(:user, username: 'jameson', email: 'jameson@example.com') }
+
+ it "should be case insensitive" do
+ User.search(user1.username.upcase).to_a.should == [user1]
+ User.search(user1.username.downcase).to_a.should == [user1]
+ User.search(user2.username.upcase).to_a.should == [user2]
+ User.search(user2.username.downcase).to_a.should == [user2]
+ end
+ end
+
describe 'by_username_or_id' do
let(:user1) { create(:user, username: 'foo') }