diff options
author | Rémy Coutable <remy@rymai.me> | 2016-09-19 08:40:29 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-09-19 08:40:29 +0000 |
commit | 42754aab184ace4e81943cd21357d4390f4d2475 (patch) | |
tree | f0a9118f428ef00b6ef11dc57cb8db35c8c05ae2 /spec/services | |
parent | 62516461d695c1e684529ab1fa807b86fb7f2ab2 (diff) | |
parent | 73f5a8eb88383563802952f53e2bc4f074016744 (diff) | |
download | gitlab-ce-42754aab184ace4e81943cd21357d4390f4d2475.tar.gz |
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
Diffstat (limited to 'spec/services')
-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 |