summaryrefslogtreecommitdiff
path: root/spec/serializers
diff options
context:
space:
mode:
Diffstat (limited to 'spec/serializers')
-rw-r--r--spec/serializers/job_entity_spec.rb4
-rw-r--r--spec/serializers/pipeline_details_entity_spec.rb14
-rw-r--r--spec/serializers/stage_entity_spec.rb11
3 files changed, 27 insertions, 2 deletions
diff --git a/spec/serializers/job_entity_spec.rb b/spec/serializers/job_entity_spec.rb
index 6a694576b4a..5ca7bf2fcaf 100644
--- a/spec/serializers/job_entity_spec.rb
+++ b/spec/serializers/job_entity_spec.rb
@@ -39,7 +39,7 @@ describe JobEntity do
expect(subject[:status]).to include :icon, :favicon, :text, :label
end
- context 'when build is retryable' do
+ context 'when job is retryable' do
before do
job.update(status: :failed)
end
@@ -49,7 +49,7 @@ describe JobEntity do
end
end
- context 'when build is cancelable' do
+ context 'when job is cancelable' do
before do
job.update(status: :running)
end
diff --git a/spec/serializers/pipeline_details_entity_spec.rb b/spec/serializers/pipeline_details_entity_spec.rb
index 03cc5ae9b63..5cb9b9945b6 100644
--- a/spec/serializers/pipeline_details_entity_spec.rb
+++ b/spec/serializers/pipeline_details_entity_spec.rb
@@ -91,6 +91,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 } })
diff --git a/spec/serializers/stage_entity_spec.rb b/spec/serializers/stage_entity_spec.rb
index 64b3217b809..40e303f7b89 100644
--- a/spec/serializers/stage_entity_spec.rb
+++ b/spec/serializers/stage_entity_spec.rb
@@ -54,6 +54,17 @@ describe StageEntity do
it 'exposes the group key' do
expect(subject).to include :groups
end
+
+ context 'and contains commit status' do
+ before do
+ create(:generic_commit_status, pipeline: pipeline, stage: 'test')
+ end
+
+ it 'contains commit status' do
+ groups = subject[:groups].map { |group| group[:name] }
+ expect(groups).to include('generic')
+ end
+ end
end
end
end