Add more specs

This commit is contained in:
Shinya Maeda 2017-03-11 23:30:25 +09:00
parent 448c695c2a
commit 08a0bc5397
5 changed files with 30 additions and 1 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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