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

describe AnalyticsStageSerializer do
  let(:serializer) do
    described_class
      .new.represent(resource)
  end

  let(:json) { serializer.as_json }
  let(:resource) { Gitlab::CycleAnalytics::CodeStage.new(project: double, options: {}) }

  before do
    allow_any_instance_of(Gitlab::CycleAnalytics::BaseStage).to receive(:median).and_return(1.12)
    allow_any_instance_of(Gitlab::CycleAnalytics::BaseEventFetcher).to receive(:event_result).and_return({})
  end

  it 'it generates payload for single object' do
    expect(json).to be_kind_of Hash
  end

  it 'contains important elements of AnalyticsStage' do
    expect(json).to include(:title, :description, :value)
  end
end