Commit 961d8793 authored by Marin Jankovski's avatar Marin Jankovski

Add the tests for user search.

parent 2e94f0d2
......@@ -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') }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment