diff options
author | James Edwards-Jones <jedwardsjones@gitlab.com> | 2017-04-05 20:59:46 +0300 |
---|---|---|
committer | James Edwards-Jones <jedwardsjones@gitlab.com> | 2017-04-06 12:56:21 +0300 |
commit | f16377e7dc762462817dd0b34e36811c55988b10 (patch) | |
tree | 0c2848cee6743f0648e2c3d9361d201aca7fbf1a /spec/services/protected_branches/update_service_spec.rb | |
parent | 18506d4b8b8bc780b3b1e4c61339af38b5c49bb2 (diff) |
Protected Tags backend review changes
Added changelog
Diffstat (limited to 'spec/services/protected_branches/update_service_spec.rb')
-rw-r--r-- | spec/services/protected_branches/update_service_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/services/protected_branches/update_service_spec.rb b/spec/services/protected_branches/update_service_spec.rb new file mode 100644 index 00000000000..62bdd49a4d7 --- /dev/null +++ b/spec/services/protected_branches/update_service_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +describe ProtectedBranches::UpdateService, services: true do + let(:protected_branch) { create(:protected_branch) } + let(:project) { protected_branch.project } + let(:user) { project.owner } + let(:params) { { name: 'new protected branch name' } } + + describe '#execute' do + subject(:service) { described_class.new(project, user, params) } + + it 'updates a protected branch' do + result = service.execute(protected_branch) + + expect(result.reload.name).to eq(params[:name]) + end + + context 'without admin_project permissions' do + let(:user) { create(:user) } + + it "raises error" do + expect{ service.execute(protected_branch) }.to raise_error(Gitlab::Access::AccessDeniedError) + end + end + end +end |