summaryrefslogtreecommitdiff
path: root/spec/services/users/update_service_spec.rb
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2017-06-13 13:52:20 +0200
committerJames Lopez <james@jameslopez.es>2017-06-23 11:41:41 +0200
commit11044ab1a02ffc681c46f1edb083dea163954b99 (patch)
tree0f49f66b6e62cb55152b98a85fbfe4e642f9481d /spec/services/users/update_service_spec.rb
parent5f0e7873ae71a1f4d23a1c564bf7eb8830ebd888 (diff)
downloadgitlab-ce-11044ab1a02ffc681c46f1edb083dea163954b99.tar.gz
fix spec
Diffstat (limited to 'spec/services/users/update_service_spec.rb')
-rw-r--r--spec/services/users/update_service_spec.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/spec/services/users/update_service_spec.rb b/spec/services/users/update_service_spec.rb
index 73af9af7507..87a3957bc3b 100644
--- a/spec/services/users/update_service_spec.rb
+++ b/spec/services/users/update_service_spec.rb
@@ -3,7 +3,6 @@ require 'spec_helper'
describe Users::UpdateService, services: true do
let(:user) { create(:user) }
let(:admin) { create(:admin) }
- let(:user) { create(:empty_user, creator_id: user.id, namespace: user.namespace) }
describe '#execute' do
it 'updates the name' do
@@ -14,20 +13,20 @@ describe Users::UpdateService, services: true do
context 'when updated by an admin' do
it 'updates the name' do
- result = update_user(user, admin, name: 'New Name')
+ result = update_user(admin, user, name: 'New Name')
expect(result).to eq({ status: :success })
expect(user.name).to eq('New Name')
end
end
it 'returns an error result when record cannot be updated' do
- result = update_user(user, create(:user), { name: 'New Name' })
-
- expect(result).to eq({ status: :error, message: 'User could not be updated' })
+ expect do
+ update_user(user, create(:user), { name: 'New Name' })
+ end.to raise_error Gitlab::Access::AccessDeniedError
end
def update_user(current_user, user, opts)
- described_class.new(user, user, opts).execute
+ described_class.new(current_user, user, opts).execute
end
end
end