diff options
author | Michael Kozono <mkozono@gmail.com> | 2017-08-18 10:31:59 -0700 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2017-08-18 10:31:59 -0700 |
commit | bd578d96b47c9fadd91fa95a7913bf65f3623128 (patch) | |
tree | 141200cfc8f89eb63907276d011bfaf4d8ec56a8 /spec/services/users | |
parent | cb1e23758380d035266bbecf87beb24fcc30d23c (diff) | |
download | gitlab-ce-bd578d96b47c9fadd91fa95a7913bf65f3623128.tar.gz |
Add namespace errors from User#after_updatemk-fix-user-namespace-rename
Diffstat (limited to 'spec/services/users')
-rw-r--r-- | spec/services/users/update_service_spec.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/spec/services/users/update_service_spec.rb b/spec/services/users/update_service_spec.rb index 343804e3de0..985f6d94876 100644 --- a/spec/services/users/update_service_spec.rb +++ b/spec/services/users/update_service_spec.rb @@ -12,9 +12,22 @@ describe Users::UpdateService do end it 'returns an error result when record cannot be updated' do + result = {} expect do - update_user(user, { email: 'invalid' }) + result = update_user(user, { email: 'invalid' }) end.not_to change { user.reload.email } + expect(result[:status]).to eq(:error) + expect(result[:message]).to eq('Email is invalid') + end + + it 'includes namespace error messages' do + create(:group, name: 'taken', path: 'something_else') + result = {} + expect do + result = update_user(user, { username: 'taken' }) + end.not_to change { user.reload.username } + expect(result[:status]).to eq(:error) + expect(result[:message]).to eq('Namespace name has already been taken') end def update_user(user, opts) |