Welcome to mirror list, hosted at ThFree Co, Russian Federation.

analytics_summary_serializer_spec.rb « serializers « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e08e3f887109bbb6884cefedefe7e2c4b3e2c4bc (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 AnalyticsSummarySerializer do
  let(:serializer) do
    described_class
      .new.represent(resource)
  end

  let(:json) { serializer.as_json }
  let(:project) { create(:empty_project) }
  let(:resource) { Gitlab::CycleAnalytics::Summary::Issue.new(project: double, from: 1.day.ago) }

  before do
    allow_any_instance_of(Gitlab::CycleAnalytics::Summary::Issue).to receive(:value).and_return(1.12)
  end

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

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