diff options
author | Douwe Maan <douwe@selenight.nl> | 2018-01-31 19:52:09 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2018-02-06 21:06:38 +0300 |
commit | 75144b1e03db342730535f1f49b0e7cd2987d755 (patch) | |
tree | 30295c514e238b48a646d77c6b453e2ec44319f4 /spec/models/user_spec.rb | |
parent | 8d69436c901a3eee674e72c67d91de3994d30e0c (diff) |
Validate path uniqueness only on Route, and bubble up appropriately
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r-- | spec/models/user_spec.rb | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 24d4d8f1741..a52dc93befe 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -116,12 +116,6 @@ describe User do expect(user).to be_valid end - it 'validates uniqueness' do - user = build(:user) - - expect(user).to validate_uniqueness_of(:username).case_insensitive - end - context 'when username is changed' do let(:user) { build_stubbed(:user, username: 'old_path', namespace: build_stubbed(:namespace)) } @@ -2287,17 +2281,17 @@ describe User do end context 'when there is a validation error (namespace name taken) while updating namespace' do - let!(:conflicting_namespace) { create(:group, name: new_username, path: 'quz') } + let!(:conflicting_namespace) { create(:group, path: new_username) } it 'causes the user save to fail' do expect(user.update_attributes(username: new_username)).to be_falsey - expect(user.namespace.errors.messages[:name].first).to eq('has already been taken') + expect(user.namespace.errors.messages[:path].first).to eq('has already been taken') end it 'adds the namespace errors to the user' do user.update_attributes(username: new_username) - expect(user.errors.full_messages.first).to eq('Namespace name has already been taken') + expect(user.errors.full_messages.first).to eq('Username has already been taken') end end end |