summaryrefslogtreecommitdiff
path: root/spec/services
diff options
context:
space:
mode:
authorJames Edwards-Jones <jedwardsjones@gitlab.com>2017-03-15 22:29:07 +0000
committerJames Edwards-Jones <jedwardsjones@gitlab.com>2017-03-31 19:37:01 +0100
commit91ed8ed687ee9edbda0098475e66ad41f886d7a5 (patch)
tree7a446fa1048484d2ccb25a37e7ce650884b7d76f /spec/services
parent1a416a42f1c1b876ecd96687e41696bc915cc2c2 (diff)
downloadgitlab-ce-91ed8ed687ee9edbda0098475e66ad41f886d7a5.tar.gz
Protected tags copy/paste from protected branches
Should provide basic CRUD backend for frontend to work from. Doesn’t include frontend, API, or the internal API used from gitlab-shell
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/protected_tags/create_service_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/services/protected_tags/create_service_spec.rb b/spec/services/protected_tags/create_service_spec.rb
new file mode 100644
index 00000000000..e1fd73dbd07
--- /dev/null
+++ b/spec/services/protected_tags/create_service_spec.rb
@@ -0,0 +1,23 @@
+require 'spec_helper'
+
+describe ProtectedTags::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 tag' do
+ expect { service.execute }.to change(ProtectedTag, :count).by(1)
+ expect(project.protected_tags.last.push_access_levels.map(&:access_level)).to eq([Gitlab::Access::MASTER])
+ expect(project.protected_tags.last.merge_access_levels.map(&:access_level)).to eq([Gitlab::Access::MASTER])
+ end
+ end
+end