diff options
author | Stan Hu <stanhu@gmail.com> | 2016-09-18 13:44:34 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2016-09-18 13:44:34 -0700 |
commit | 73f5a8eb88383563802952f53e2bc4f074016744 (patch) | |
tree | c47d5e79ed546d2341b2b8b30401d750c395bb77 | |
parent | d38499b3a785ea9d15cb3f108764d20016ea8ea7 (diff) | |
download | gitlab-ce-sh-add-spec-create-service-protected-branch.tar.gz |
Add missing spec for ProtectedBranches::CreateServicesh-add-spec-create-service-protected-branch
-rw-r--r-- | spec/services/protected_branches/create_service_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/services/protected_branches/create_service_spec.rb b/spec/services/protected_branches/create_service_spec.rb new file mode 100644 index 00000000000..7d4eff3b6ef --- /dev/null +++ b/spec/services/protected_branches/create_service_spec.rb @@ -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 |