debian-mirror-gitlab/spec/services/protected_branches/update_service_spec.rb

27 lines
749 B
Ruby
Raw Normal View History

2017-08-17 22:00:37 +05:30
require 'spec_helper'
2017-09-10 17:25:29 +05:30
describe ProtectedBranches::UpdateService do
2017-08-17 22:00:37 +05:30
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
2018-03-17 18:26:18 +05:30
expect { service.execute(protected_branch) }.to raise_error(Gitlab::Access::AccessDeniedError)
2017-08-17 22:00:37 +05:30
end
end
end
end