BigW Consortium Gitlab

Commit 42754aab by Rémy Coutable

Merge branch 'sh-add-spec-create-service-protected-branch' into 'master'

Add missing spec for ProtectedBranches::CreateService While working on !6399, I noticed there was no spec for this class so I added one. See merge request !6405
parents 62516461 73f5a8eb
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment