diff options
author | Mayra Cabrera <mcabrera@gitlab.com> | 2017-12-08 17:42:43 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-12-08 17:42:43 +0000 |
commit | 562fb460b83502c060cd84b1627dc33098e01c31 (patch) | |
tree | 36d354ef789c26146f29a00400c240b76f5c02ca /spec/models/user_spec.rb | |
parent | 8730054683c00f4c79cf452beef0df794c70bf6b (diff) | |
download | gitlab-ce-562fb460b83502c060cd84b1627dc33098e01c31.tar.gz |
Allow git pull/push on project redirects
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r-- | spec/models/user_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 03c96a8f5aa..cdabd35b6ba 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -2592,4 +2592,28 @@ describe User do include_examples 'max member access for groups' end end + + describe "#username_previously_taken?" do + let(:user1) { create(:user, username: 'foo') } + + context 'when the username has been taken before' do + before do + user1.username = 'bar' + user1.save! + end + + it 'should raise an ActiveRecord::RecordInvalid exception' do + user2 = build(:user, username: 'foo') + expect { user2.save! }.to raise_error(ActiveRecord::RecordInvalid, /Path foo has been taken before/) + end + end + + context 'when the username has not been taken before' do + it 'should be valid' do + expect(RedirectRoute.count).to eq(0) + user2 = build(:user, username: 'baz') + expect(user2).to be_valid + end + end + end end |