diff options
| author | Rémy Coutable <remy@rymai.me> | 2016-10-28 12:38:00 +0000 |
|---|---|---|
| committer | Rémy Coutable <remy@rymai.me> | 2016-10-28 12:38:00 +0000 |
| commit | 04c7c8d8bbc99eaee728c1ca3572b7ae2dc8d2fb (patch) | |
| tree | 1b979be28d6d5c4accbc2c888d2638458d860c82 /spec | |
| parent | 8487af81db7a2d490cbdd3ae16e87c44df883396 (diff) | |
| parent | af1936def9f03200be3b84748e67d7935c30d7fd (diff) | |
| download | gitlab-ce-04c7c8d8bbc99eaee728c1ca3572b7ae2dc8d2fb.tar.gz | |
Merge branch '5905-duplicate-email-errors' into 'master'
Only show one error message for an invalid email
Changes it to only validate the notification_email format if it's different from email.
Closes #5905
See merge request !7158
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/controllers/admin/users_controller_spec.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/controllers/admin/users_controller_spec.rb b/spec/controllers/admin/users_controller_spec.rb index 33fe3c73822..2ab2ca1b667 100644 --- a/spec/controllers/admin/users_controller_spec.rb +++ b/spec/controllers/admin/users_controller_spec.rb @@ -114,6 +114,17 @@ describe Admin::UsersController do end end + describe 'POST create' do + it 'creates the user' do + expect{ post :create, user: attributes_for(:user) }.to change{ User.count }.by(1) + end + + it 'shows only one error message for an invalid email' do + post :create, user: attributes_for(:user, email: 'bogus') + expect(assigns[:user].errors).to contain_exactly("Email is invalid") + end + end + describe 'POST update' do context 'when the password has changed' do def update_password(user, password, password_confirmation = nil) |
