2016-11-14 05:52:29 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe AnalyticsBuildSerializer do
|
|
|
|
let(:serializer) do
|
|
|
|
described_class
|
2016-11-15 03:39:45 -05:00
|
|
|
.new.represent(resource)
|
2016-11-14 05:52:29 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
let(:json) { serializer.as_json }
|
|
|
|
let(:resource) { create(:ci_build) }
|
|
|
|
|
|
|
|
context 'when there is a single object provided' do
|
|
|
|
it 'it generates payload for single object' do
|
|
|
|
expect(json).to be_an_instance_of Hash
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'contains important elements of analyticsBuild' do
|
|
|
|
expect(json)
|
2016-11-15 03:39:45 -05:00
|
|
|
.to include(:name, :branch, :short_sha, :date, :total_time, :url, :author)
|
2016-11-14 05:52:29 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|