diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-07-23 17:16:39 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-07-23 17:16:39 -0400 |
commit | 5ce6d18681ee7b74ba0c443672224dd580bd34b0 (patch) | |
tree | c001072e30cfafb32b8ffb0a982476868ca91331 /spec | |
parent | a364d4260d357c10d45108da8f8ab55426c64fa2 (diff) | |
download | gitlab-ce-5ce6d18681ee7b74ba0c443672224dd580bd34b0.tar.gz |
Add User.find_by_username!rs-issue-2012
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/user_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 16902317f10..76f16323e2f 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -442,6 +442,18 @@ describe User do end end + describe '.find_by_username!' do + it 'raises RecordNotFound' do + expect { described_class.find_by_username!('JohnDoe') }. + to raise_error(ActiveRecord::RecordNotFound) + end + + it 'is case-insensitive' do + user = create(:user, username: 'JohnDoe') + expect(described_class.find_by_username!('JOHNDOE')).to eq user + end + end + describe 'all_ssh_keys' do it { is_expected.to have_many(:keys).dependent(:destroy) } |