fix spec failures
This commit is contained in:
parent
24c2aa39ad
commit
e56c305be0
10 changed files with 64 additions and 28 deletions
|
@ -2,9 +2,9 @@ require 'spec_helper'
|
|||
require 'lib/gitlab/cycle_analytics/shared_event_spec'
|
||||
|
||||
describe Gitlab::CycleAnalytics::CodeEvent do
|
||||
it_behaves_like 'default query config'
|
||||
|
||||
it 'has the default order' do
|
||||
expect(described_class.order).not_to eq(described_class.start_time_attrs)
|
||||
it_behaves_like 'default query config' do
|
||||
it 'does not have the default order' do
|
||||
expect(event.order).not_to eq(event.start_time_attrs)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,9 +2,9 @@ require 'spec_helper'
|
|||
require 'lib/gitlab/cycle_analytics/shared_event_spec'
|
||||
|
||||
describe Gitlab::CycleAnalytics::IssueEvent do
|
||||
it_behaves_like 'default query config'
|
||||
|
||||
it 'has the default order' do
|
||||
expect(described_class.order).to eq(described_class.start_time_attrs)
|
||||
it_behaves_like 'default query config' do
|
||||
it 'has the default order' do
|
||||
expect(event.order).to eq(event.start_time_attrs)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,9 +2,9 @@ require 'spec_helper'
|
|||
require 'lib/gitlab/cycle_analytics/shared_event_spec'
|
||||
|
||||
describe Gitlab::CycleAnalytics::PlanEvent do
|
||||
it_behaves_like 'default query config'
|
||||
|
||||
it 'has the default order' do
|
||||
expect(described_class.order).to eq(described_class.start_time_attrs)
|
||||
it_behaves_like 'default query config' do
|
||||
it 'has the default order' do
|
||||
expect(event.order).to eq(event.start_time_attrs)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,6 +5,6 @@ describe Gitlab::CycleAnalytics::ProductionEvent do
|
|||
it_behaves_like 'default query config'
|
||||
|
||||
it 'has the default order' do
|
||||
expect(described_class.order).to eq(described_class.start_time_attrs)
|
||||
expect(event.order).to eq(event.start_time_attrs)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,6 +5,6 @@ describe Gitlab::CycleAnalytics::ReviewEvent do
|
|||
it_behaves_like 'default query config'
|
||||
|
||||
it 'has the default order' do
|
||||
expect(described_class.order).to eq(described_class.start_time_attrs)
|
||||
expect(event.order).to eq(event.start_time_attrs)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
require 'spec_helper'
|
||||
|
||||
shared_examples 'default query config' do
|
||||
let(:event) { described_class.new(project: double, options: {}) }
|
||||
|
||||
it 'has the start attributes' do
|
||||
expect(described_class.start_time_attrs).not_to be_nil
|
||||
expect(event.start_time_attrs).not_to be_nil
|
||||
end
|
||||
|
||||
it 'has the stage attribute' do
|
||||
expect(described_class.stage).not_to be_nil
|
||||
expect(event.stage).not_to be_nil
|
||||
end
|
||||
|
||||
it 'has the end attributes' do
|
||||
expect(described_class.end_time_attrs).not_to be_nil
|
||||
expect(event.end_time_attrs).not_to be_nil
|
||||
end
|
||||
|
||||
it 'has the projection attributes' do
|
||||
expect(described_class.projections).not_to be_nil
|
||||
expect(event.projections).not_to be_nil
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,9 +2,9 @@ require 'spec_helper'
|
|||
require 'lib/gitlab/cycle_analytics/shared_event_spec'
|
||||
|
||||
describe Gitlab::CycleAnalytics::StagingEvent do
|
||||
it_behaves_like 'default query config'
|
||||
|
||||
it 'has the default order' do
|
||||
expect(described_class.order).not_to eq(described_class.start_time_attrs)
|
||||
it_behaves_like 'default query config' do
|
||||
it 'does not have the default order' do
|
||||
expect(event.order).not_to eq(event.start_time_attrs)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,9 +2,9 @@ require 'spec_helper'
|
|||
require 'lib/gitlab/cycle_analytics/shared_event_spec'
|
||||
|
||||
describe Gitlab::CycleAnalytics::TestEvent do
|
||||
it_behaves_like 'default query config'
|
||||
|
||||
it 'has the default order' do
|
||||
expect(described_class.order).not_to eq(described_class.start_time_attrs)
|
||||
it_behaves_like 'default query config' do
|
||||
it 'does not have the default order' do
|
||||
expect(event.order).not_to eq(event.start_time_attrs)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe AnalyticsGenericSerializer do
|
||||
describe AnalyticsIssueSerializer do
|
||||
let(:serializer) do
|
||||
described_class
|
||||
.new(project: project, entity: :merge_request)
|
||||
|
@ -26,7 +26,7 @@ describe AnalyticsGenericSerializer do
|
|||
expect(json).to be_an_instance_of Hash
|
||||
end
|
||||
|
||||
it 'contains important elements of analyticsBuild' do
|
||||
it 'contains important elements of the issue' do
|
||||
expect(json).to include(:title, :iid, :created_at, :total_time, :url, :author)
|
||||
end
|
||||
end
|
34
spec/serializers/analytics_merge_request_serializer_spec.rb
Normal file
34
spec/serializers/analytics_merge_request_serializer_spec.rb
Normal file
|
@ -0,0 +1,34 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe AnalyticsMergeRequestSerializer do
|
||||
let(:serializer) do
|
||||
described_class
|
||||
.new(project: project, entity: :merge_request)
|
||||
.represent(resource)
|
||||
end
|
||||
|
||||
let(:user) { create(:user) }
|
||||
let(:json) { serializer.as_json }
|
||||
let(:project) { create(:project) }
|
||||
let(:resource) do
|
||||
{
|
||||
total_time: "172802.724419",
|
||||
title: "Eos voluptatem inventore in sed.",
|
||||
iid: "1",
|
||||
id: "1",
|
||||
state: 'open',
|
||||
created_at: "2016-11-12 15:04:02.948604",
|
||||
author: user
|
||||
}
|
||||
end
|
||||
|
||||
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 the merge request' do
|
||||
expect(json).to include(:title, :iid, :created_at, :total_time, :url, :author, :state)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue