diff options
| author | Andrey Krivko <jastkand@gmail.com> | 2014-10-22 22:29:26 +0700 |
|---|---|---|
| committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-10-30 18:29:18 +0200 |
| commit | bafd30f92cfb754fe6864c9cd595df10b52b11f2 (patch) | |
| tree | 5f46e2435bf87e4b52b4b459bcffe5f2754d3789 /spec/models | |
| parent | 8388bbe82918d2fca2600620f48e048ccfab2c97 (diff) | |
| download | gitlab-ce-bafd30f92cfb754fe6864c9cd595df10b52b11f2.tar.gz | |
Session API: Use case-insensitive authentication like in UI
Diffstat (limited to 'spec/models')
| -rw-r--r-- | spec/models/user_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 6ad57b06e06..6d865cfc691 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -287,6 +287,20 @@ describe User do end end + describe '.by_login' do + let(:username) { 'John' } + let!(:user) { create(:user, username: username) } + + it 'should get the correct user' do + expect(User.by_login(user.email.upcase)).to eq user + expect(User.by_login(user.email)).to eq user + expect(User.by_login(username.downcase)).to eq user + expect(User.by_login(username)).to eq user + expect(User.by_login(nil)).to be_nil + expect(User.by_login('')).to be_nil + end + end + describe 'all_ssh_keys' do it { should have_many(:keys).dependent(:destroy) } |
