summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/ci
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-05-31 22:58:34 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-05-31 22:58:34 +0800
commitafb1bf0baf23a6e7b111fb5b305c16c38cf3a99e (patch)
tree6f7981f1d809e205df6bbe13638c28d91f3caeed /spec/lib/gitlab/ci
parent258cdd14b557b96c5340ea91c6915b8787ce1b1e (diff)
parent4ad85b22e25ab9b2d089fce7138f07c72c5fd5d6 (diff)
downloadgitlab-ce-afb1bf0baf23a6e7b111fb5b305c16c38cf3a99e.tar.gz
Merge remote-tracking branch 'upstream/master' into rename-builds-controller
* upstream/master: (63 commits) Update docs related to protected actions Add changelog for protected branches abilities fix Ask for an example project for bug reports Center loading spinner in issuable filters Fix chat commands specs related to protected actions Fix builds controller specs related to protected actions Fix pipeline retry specs related to protected actions Fix environment model specs related to protected actions Fix build factory specs related to protected actions Fix job play service specs related to protected actions Fix play status specs related to protected actions Fix deploy chat command specs for protected actions Fix environment specs related to protected actions Fix pipeline processing specs related to protected actions Fix build entity specs related to protected actions Check only a merge ability for protected actions Add tag_list param to project api Allow PostReceivePack to be enabled with Gitaly Remove some deprecated methods Add :owned param to ProjectFinder ...
Diffstat (limited to 'spec/lib/gitlab/ci')
-rw-r--r--spec/lib/gitlab/ci/status/build/factory_spec.rb5
-rw-r--r--spec/lib/gitlab/ci/status/build/play_spec.rb10
2 files changed, 12 insertions, 3 deletions
diff --git a/spec/lib/gitlab/ci/status/build/factory_spec.rb b/spec/lib/gitlab/ci/status/build/factory_spec.rb
index 185bb9098da..3f30b2c38f2 100644
--- a/spec/lib/gitlab/ci/status/build/factory_spec.rb
+++ b/spec/lib/gitlab/ci/status/build/factory_spec.rb
@@ -224,7 +224,10 @@ describe Gitlab::Ci::Status::Build::Factory do
context 'when user has ability to play action' do
before do
- build.project.add_master(user)
+ project.add_developer(user)
+
+ create(:protected_branch, :developers_can_merge,
+ name: build.ref, project: project)
end
it 'fabricates status that has action' do
diff --git a/spec/lib/gitlab/ci/status/build/play_spec.rb b/spec/lib/gitlab/ci/status/build/play_spec.rb
index f5d0f977768..0e15a5f3c6b 100644
--- a/spec/lib/gitlab/ci/status/build/play_spec.rb
+++ b/spec/lib/gitlab/ci/status/build/play_spec.rb
@@ -2,6 +2,7 @@ require 'spec_helper'
describe Gitlab::Ci::Status::Build::Play do
let(:user) { create(:user) }
+ let(:project) { build.project }
let(:build) { create(:ci_build, :manual) }
let(:status) { Gitlab::Ci::Status::Core.new(build, user) }
@@ -15,8 +16,13 @@ describe Gitlab::Ci::Status::Build::Play do
describe '#has_action?' do
context 'when user is allowed to update build' do
- context 'when user can push to branch' do
- before { build.project.add_master(user) }
+ context 'when user is allowed to trigger protected action' do
+ before do
+ project.add_developer(user)
+
+ create(:protected_branch, :developers_can_merge,
+ name: build.ref, project: project)
+ end
it { is_expected.to have_action }
end