Add missing spec for ProtectedBranches::CreateService
This commit is contained in:
parent
d38499b3a7
commit
73f5a8eb88
1 changed files with 23 additions and 0 deletions
23
spec/services/protected_branches/create_service_spec.rb
Normal file
23
spec/services/protected_branches/create_service_spec.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe ProtectedBranches::CreateService, services: true do
|
||||
let(:project) { create(:empty_project) }
|
||||
let(:user) { project.owner }
|
||||
let(:params) do
|
||||
{
|
||||
name: 'master',
|
||||
merge_access_levels_attributes: [ { access_level: Gitlab::Access::MASTER } ],
|
||||
push_access_levels_attributes: [ { access_level: Gitlab::Access::MASTER } ]
|
||||
}
|
||||
end
|
||||
|
||||
describe '#execute' do
|
||||
subject(:service) { described_class.new(project, user, params) }
|
||||
|
||||
it 'creates a new protected branch' do
|
||||
expect { service.execute }.to change(ProtectedBranch, :count).by(1)
|
||||
expect(project.protected_branches.last.push_access_levels.map(&:access_level)).to eq([Gitlab::Access::MASTER])
|
||||
expect(project.protected_branches.last.merge_access_levels.map(&:access_level)).to eq([Gitlab::Access::MASTER])
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue