diff --git a/spec/controllers/projects/builds_controller_spec.rb b/spec/controllers/projects/builds_controller_spec.rb index c6a3bce93da852f7d9ea407d6e19c0373b83e377..2234b2e613100ff46c136c4441238790feea1dcb 100644 --- a/spec/controllers/projects/builds_controller_spec.rb +++ b/spec/controllers/projects/builds_controller_spec.rb @@ -27,6 +27,9 @@ describe Projects::BuildsController do it 'return a correct pipeline status' do expect(response).to have_http_status(:ok) + expect(json_response['text']).to eq status.text + expect(json_response['label']).to eq status.label + expect(json_response['icon']).to eq status.icon expect(json_response['favicon']).to eq status.favicon end end diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb index 19c4ba25d1bb9b96c69faa07a4b175b8818c1969..8b9a26aabffdbdc13d6818f5f9510c2a75d64828 100644 --- a/spec/controllers/projects/merge_requests_controller_spec.rb +++ b/spec/controllers/projects/merge_requests_controller_spec.rb @@ -1198,6 +1198,9 @@ describe Projects::MergeRequestsController do it 'return a correct pipeline status' do expect(response).to have_http_status(:ok) + expect(json_response['text']).to eq status.text + expect(json_response['label']).to eq status.label + expect(json_response['icon']).to eq status.icon expect(json_response['favicon']).to eq status.favicon end end diff --git a/spec/controllers/projects/pipelines_controller_spec.rb b/spec/controllers/projects/pipelines_controller_spec.rb index 53d0ebda2d503c871c793d365bf6a1f76e13eb73..9ce8f8e8da16aa01286e3d69d8c209e92e0b97e7 100644 --- a/spec/controllers/projects/pipelines_controller_spec.rb +++ b/spec/controllers/projects/pipelines_controller_spec.rb @@ -86,6 +86,9 @@ describe Projects::PipelinesController do it 'return a correct pipeline status' do expect(response).to have_http_status(:ok) + expect(json_response['text']).to eq status.text + expect(json_response['label']).to eq status.label + expect(json_response['icon']).to eq status.icon expect(json_response['favicon']).to eq status.favicon end end diff --git a/spec/serializers/build_serializer_spec.rb b/spec/serializers/build_serializer_spec.rb index a8069004e7bc2866affd0c4d2c36095cb7041419..5a55d9d7dc18c9f6f9c2b593563bc9cc57be772e 100644 --- a/spec/serializers/build_serializer_spec.rb +++ b/spec/serializers/build_serializer_spec.rb @@ -10,7 +10,21 @@ describe BuildSerializer do subject { serializer.represent(resource) } describe '#represent' do - # TODO: + context 'when a single object is being serialized' do + let(:resource) { create(:ci_build) } + + it 'serializers the pipeline object' do + expect(subject[:id]).to eq resource.id + end + end + + context 'when multiple objects are being serialized' do + let(:resource) { create_list(:ci_build, 2) } + + it 'serializers the array of pipelines' do + expect(subject).not_to be_empty + end + end end describe '#represent_status' do @@ -23,6 +37,9 @@ describe BuildSerializer do subject { serializer.represent_status(resource) } it 'serializes only status' do + expect(subject[:text]).to eq(status.text) + expect(subject[:label]).to eq(status.label) + expect(subject[:icon]).to eq(status.icon) expect(subject[:favicon]).to eq(status.favicon) end end diff --git a/spec/serializers/pipeline_serializer_spec.rb b/spec/serializers/pipeline_serializer_spec.rb index a668d9df11aeeffd9b26633a5f4fe6c9ea493b9f..261f2152c22d85828d8e5dfcc02ae3b1cf65c68d 100644 --- a/spec/serializers/pipeline_serializer_spec.rb +++ b/spec/serializers/pipeline_serializer_spec.rb @@ -105,6 +105,9 @@ describe PipelineSerializer do subject { serializer.represent_status(resource) } it 'serializes only status' do + expect(subject[:text]).to eq(status.text) + expect(subject[:label]).to eq(status.label) + expect(subject[:icon]).to eq(status.icon) expect(subject[:favicon]).to eq(status.favicon) end end