diff options
author | Shinya Maeda <shinya@gitlab.com> | 2019-03-07 14:33:13 +0700 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2019-03-13 21:36:27 +0700 |
commit | 05c0377008438025a7e3396effefc197f6bf2a97 (patch) | |
tree | b92e8ecac3bcbc41f3be87c0629eedacd45e8c46 /spec/serializers | |
parent | 69ed9ae4d4bc0a64713c9a01d6ac27f9fc303101 (diff) | |
download | gitlab-ce-05c0377008438025a7e3396effefc197f6bf2a97.tar.gz |
Add attached flag to pipeline entity
Add spec
Fix
Fix
Add changelog
Drop attached
Remove attached
Update changelog
ok
Diffstat (limited to 'spec/serializers')
-rw-r--r-- | spec/serializers/pipeline_entity_spec.rb | 19 | ||||
-rw-r--r-- | spec/serializers/pipeline_serializer_spec.rb | 4 |
2 files changed, 19 insertions, 4 deletions
diff --git a/spec/serializers/pipeline_entity_spec.rb b/spec/serializers/pipeline_entity_spec.rb index d510293ae38..c8308a0ae85 100644 --- a/spec/serializers/pipeline_entity_spec.rb +++ b/spec/serializers/pipeline_entity_spec.rb @@ -3,6 +3,7 @@ require 'spec_helper' describe PipelineEntity do include Gitlab::Routing + set(:project) { create(:project) } set(:user) { create(:user) } set(:project) { create(:project) } let(:request) { double('request') } @@ -134,12 +135,12 @@ describe PipelineEntity do end context 'when pipeline is detached merge request pipeline' do - let(:merge_request) { create(:merge_request, :with_merge_request_pipeline) } + let(:merge_request) { create(:merge_request, :with_detached_merge_request_pipeline) } let(:project) { merge_request.target_project } let(:pipeline) { merge_request.merge_request_pipelines.first } it 'makes detached flag true' do - expect(subject[:flags][:detached]).to be_truthy + expect(subject[:flags][:detached_merge_request_pipeline]).to be_truthy end context 'when user is a developer' do @@ -175,5 +176,19 @@ describe PipelineEntity do end end end + + context 'when pipeline is merge request pipeline' do + let(:merge_request) { create(:merge_request, :with_merge_request_pipeline, merge_sha: 'abc') } + let(:project) { merge_request.target_project } + let(:pipeline) { merge_request.merge_request_pipelines.first } + + it 'makes detached flag false' do + expect(subject[:flags][:detached_merge_request_pipeline]).to be_falsy + end + + it 'makes atached flag true' do + expect(subject[:flags][:merge_request_pipeline]).to be_truthy + end + end end end diff --git a/spec/serializers/pipeline_serializer_spec.rb b/spec/serializers/pipeline_serializer_spec.rb index cead75c0895..0fdd675aa01 100644 --- a/spec/serializers/pipeline_serializer_spec.rb +++ b/spec/serializers/pipeline_serializer_spec.rb @@ -102,7 +102,7 @@ describe PipelineSerializer do let!(:merge_request_1) do create(:merge_request, - :with_merge_request_pipeline, + :with_detached_merge_request_pipeline, target_project: project, target_branch: 'master', source_project: project, @@ -111,7 +111,7 @@ describe PipelineSerializer do let!(:merge_request_2) do create(:merge_request, - :with_merge_request_pipeline, + :with_detached_merge_request_pipeline, target_project: project, target_branch: 'master', source_project: project, |