2016-11-22 05:46:02 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe AnalyticsSummarySerializer do
|
2017-01-27 07:02:59 -05:00
|
|
|
subject do
|
|
|
|
described_class.new.represent(resource)
|
2016-11-22 05:46:02 -05:00
|
|
|
end
|
|
|
|
|
2017-08-02 15:55:11 -04:00
|
|
|
let(:project) { create(:project) }
|
2016-12-01 09:40:46 -05:00
|
|
|
let(:user) { create(:user) }
|
2017-01-27 07:02:59 -05:00
|
|
|
|
2016-12-01 09:40:46 -05:00
|
|
|
let(:resource) do
|
2017-01-27 07:02:59 -05:00
|
|
|
Gitlab::CycleAnalytics::Summary::Issue
|
|
|
|
.new(project: double, from: 1.day.ago, current_user: user)
|
2016-12-01 09:40:46 -05:00
|
|
|
end
|
2016-11-22 05:46:02 -05:00
|
|
|
|
|
|
|
before do
|
2017-01-27 07:02:59 -05:00
|
|
|
allow_any_instance_of(Gitlab::CycleAnalytics::Summary::Issue)
|
|
|
|
.to receive(:value).and_return(1.12)
|
2016-11-22 05:46:02 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'it generates payload for single object' do
|
2017-01-27 07:02:59 -05:00
|
|
|
expect(subject).to be_kind_of Hash
|
2016-11-22 05:46:02 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'contains important elements of AnalyticsStage' do
|
2017-01-27 07:02:59 -05:00
|
|
|
expect(subject).to include(:title, :value)
|
2016-11-22 05:46:02 -05:00
|
|
|
end
|
|
|
|
end
|