Commit 08a0bc53 authored by Shinya Maeda's avatar Shinya Maeda

Add more specs

parent 448c695c
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment