From 961d87937b55535ff3ffd041dbc78af82d644daa Mon Sep 17 00:00:00 2001
From: Marin Jankovski <marin@gitlab.com>
Date: Wed, 26 Mar 2014 12:44:00 +0100
Subject: [PATCH] Add the tests for user search.

---
 spec/models/user_spec.rb | 12 ++++++++++++
 1 file changed, 12 insertions(+)

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') }
 
-- 
2.30.9