summaryrefslogtreecommitdiff
path: root/spec/serializers
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-07-18 22:32:34 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-07-18 23:48:14 +0800
commit7bd5e571256aff6de132b118f04224e56abf3228 (patch)
tree4ec27daa73e2588299b73686ee8954ac299915b1 /spec/serializers
parent1ed6d1541c7973c08cdd4c1906ddcc0c3db893e3 (diff)
downloadgitlab-ce-7bd5e571256aff6de132b118f04224e56abf3228.tar.gz
Instead of adding master, stub_not_protect_default_branch
Diffstat (limited to 'spec/serializers')
-rw-r--r--spec/serializers/job_entity_spec.rb11
-rw-r--r--spec/serializers/pipeline_details_entity_spec.rb6
-rw-r--r--spec/serializers/pipeline_entity_spec.rb6
3 files changed, 16 insertions, 7 deletions
diff --git a/spec/serializers/job_entity_spec.rb b/spec/serializers/job_entity_spec.rb
index ec30816654b..026360e91a3 100644
--- a/spec/serializers/job_entity_spec.rb
+++ b/spec/serializers/job_entity_spec.rb
@@ -7,8 +7,10 @@ describe JobEntity do
let(:request) { double('request') }
before do
+ stub_not_protect_default_branch
allow(request).to receive(:current_user).and_return(user)
- project.add_master(user)
+
+ project.add_developer(user)
end
let(:entity) do
@@ -77,7 +79,7 @@ describe JobEntity do
project.add_developer(user)
create(:protected_branch, :developers_can_merge,
- name: 'master', project: project)
+ name: job.ref, project: job.project)
end
it 'contains path to play action' do
@@ -91,7 +93,10 @@ describe JobEntity do
context 'when user is not allowed to trigger action' do
before do
- project.team.truncate
+ allow(job.project).to receive(:empty_repo?).and_return(false)
+
+ create(:protected_branch, :no_one_can_push,
+ name: job.ref, project: job.project)
end
it 'does not contain path to play action' do
diff --git a/spec/serializers/pipeline_details_entity_spec.rb b/spec/serializers/pipeline_details_entity_spec.rb
index e9b24b47900..b990370a271 100644
--- a/spec/serializers/pipeline_details_entity_spec.rb
+++ b/spec/serializers/pipeline_details_entity_spec.rb
@@ -9,6 +9,8 @@ describe PipelineDetailsEntity do
end
before do
+ stub_not_protect_default_branch
+
allow(request).to receive(:current_user).and_return(user)
end
@@ -52,7 +54,7 @@ describe PipelineDetailsEntity do
context 'user has ability to retry pipeline' do
before do
- project.add_master(user)
+ project.add_developer(user)
end
it 'retryable flag is true' do
@@ -80,7 +82,7 @@ describe PipelineDetailsEntity do
context 'user has ability to cancel pipeline' do
before do
- project.add_master(user)
+ project.add_developer(user)
end
it 'cancelable flag is true' do
diff --git a/spec/serializers/pipeline_entity_spec.rb b/spec/serializers/pipeline_entity_spec.rb
index 46433867b11..5b01cc4fc9e 100644
--- a/spec/serializers/pipeline_entity_spec.rb
+++ b/spec/serializers/pipeline_entity_spec.rb
@@ -5,6 +5,8 @@ describe PipelineEntity do
let(:request) { double('request') }
before do
+ stub_not_protect_default_branch
+
allow(request).to receive(:current_user).and_return(user)
end
@@ -52,7 +54,7 @@ describe PipelineEntity do
context 'user has ability to retry pipeline' do
before do
- project.add_master(user)
+ project.add_developer(user)
end
it 'contains retry path' do
@@ -80,7 +82,7 @@ describe PipelineEntity do
context 'user has ability to cancel pipeline' do
before do
- project.add_master(user)
+ project.add_developer(user)
end
it 'contains cancel path' do