summaryrefslogtreecommitdiff
path: root/spec/serializers/analytics_build_serializer_spec.rb
blob: a0a9d9a5f12997ea8b3b2993b57d878bc5507a85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'spec_helper'

describe AnalyticsBuildSerializer do
  let(:serializer) do
    described_class
      .new.represent(resource)
  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)
        .to include(:name, :branch, :short_sha, :date, :total_time, :url, :author)
    end
  end
end