2017-03-15 22:29:07 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe ProtectedTags::CreateService, services: true do
|
|
|
|
let(:project) { create(:empty_project) }
|
|
|
|
let(:user) { project.owner }
|
|
|
|
let(:params) do
|
|
|
|
{
|
|
|
|
name: 'master',
|
2017-04-04 02:37:22 +00:00
|
|
|
create_access_levels_attributes: [{ access_level: Gitlab::Access::MASTER }]
|
2017-03-15 22:29:07 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#execute' do
|
|
|
|
subject(:service) { described_class.new(project, user, params) }
|
|
|
|
|
|
|
|
it 'creates a new protected tag' do
|
|
|
|
expect { service.execute }.to change(ProtectedTag, :count).by(1)
|
2017-04-04 02:37:22 +00:00
|
|
|
expect(project.protected_tags.last.create_access_levels.map(&:access_level)).to eq([Gitlab::Access::MASTER])
|
2017-03-15 22:29:07 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|