diff options
Diffstat (limited to 'spec/serializers/pipeline_details_entity_spec.rb')
-rw-r--r-- | spec/serializers/pipeline_details_entity_spec.rb | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/spec/serializers/pipeline_details_entity_spec.rb b/spec/serializers/pipeline_details_entity_spec.rb index 03cc5ae9b63..f60d1843581 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 @@ -40,7 +42,7 @@ describe PipelineDetailsEntity do end context 'when pipeline is retryable' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } let(:pipeline) do create(:ci_pipeline, status: :success, project: project) @@ -51,7 +53,9 @@ describe PipelineDetailsEntity do end context 'user has ability to retry pipeline' do - before { project.team << [user, :developer] } + before do + project.add_developer(user) + end it 'retryable flag is true' do expect(subject[:flags][:retryable]).to eq true @@ -66,7 +70,7 @@ describe PipelineDetailsEntity do end context 'when pipeline is cancelable' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } let(:pipeline) do create(:ci_pipeline, status: :running, project: project) @@ -77,7 +81,9 @@ describe PipelineDetailsEntity do end context 'user has ability to cancel pipeline' do - before { project.add_developer(user) } + before do + project.add_developer(user) + end it 'cancelable flag is true' do expect(subject[:flags][:cancelable]).to eq true @@ -91,6 +97,20 @@ describe PipelineDetailsEntity do end end + context 'when pipeline has commit statuses' do + let(:pipeline) { create(:ci_empty_pipeline) } + + before do + create(:generic_commit_status, pipeline: pipeline) + end + + it 'contains stages' do + expect(subject).to include(:details) + expect(subject[:details]).to include(:stages) + expect(subject[:details][:stages].first).to include(name: 'external') + end + end + context 'when pipeline has YAML errors' do let(:pipeline) do create(:ci_pipeline, config: { rspec: { invalid: :value } }) |