diff options
Diffstat (limited to 'spec')
5 files changed, 14 insertions, 9 deletions
diff --git a/spec/lib/gitlab/cycle_analytics/plan_event_spec.rb b/spec/lib/gitlab/cycle_analytics/plan_event_spec.rb index 5c4b8b343bd..df407e51c64 100644 --- a/spec/lib/gitlab/cycle_analytics/plan_event_spec.rb +++ b/spec/lib/gitlab/cycle_analytics/plan_event_spec.rb @@ -11,7 +11,7 @@ describe Gitlab::CycleAnalytics::PlanEvent do context 'no commits' do it 'does not blow up if there are no commits' do - allow_any_instance_of(Gitlab::CycleAnalytics::EventsQuery).to receive(:execute).and_return([{}]) + allow_any_instance_of(Gitlab::CycleAnalytics::MetricsFetcher).to receive(:events).and_return([{}]) expect { event.fetch }.not_to raise_error end diff --git a/spec/lib/gitlab/cycle_analytics/shared_event_spec.rb b/spec/lib/gitlab/cycle_analytics/shared_event_spec.rb index 0b0ea662b74..5e1c7531fb5 100644 --- a/spec/lib/gitlab/cycle_analytics/shared_event_spec.rb +++ b/spec/lib/gitlab/cycle_analytics/shared_event_spec.rb @@ -7,7 +7,7 @@ shared_examples 'default query config' do branch: nil) end - let(:event) { described_class.new(fetcher: fetcher, stage: stage_name, options: {}) } + let(:event) { described_class.new(fetcher: fetcher, options: {}) } it 'has the start attributes' do expect(event.start_time_attrs).not_to be_nil diff --git a/spec/lib/gitlab/cycle_analytics/shared_stage_spec.rb b/spec/lib/gitlab/cycle_analytics/shared_stage_spec.rb index f4189d3c7fc..cfb5dc12ff1 100644 --- a/spec/lib/gitlab/cycle_analytics/shared_stage_spec.rb +++ b/spec/lib/gitlab/cycle_analytics/shared_stage_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' shared_examples 'base stage' do - let(:stage) { described_class.new(project: double, options: {}, stage: stage_name) } + let(:stage) { described_class.new(project: double, options: {}) } before do allow_any_instance_of(Gitlab::CycleAnalytics::MetricsFetcher).to receive(:median).and_return(1.12) @@ -20,8 +20,8 @@ shared_examples 'base stage' do expect(stage.median_data[:description]).not_to be_nil end - it 'has the stage' do - expect(stage.stage).to eq(stage_name) + it 'has the title' do + expect(stage.title).to eq(stage_name.to_s.capitalize) end it 'has the events' do diff --git a/spec/serializers/analytics_stage_serializer_spec.rb b/spec/serializers/analytics_stage_serializer_spec.rb index 47c537fcf84..3627a21230f 100644 --- a/spec/serializers/analytics_stage_serializer_spec.rb +++ b/spec/serializers/analytics_stage_serializer_spec.rb @@ -7,7 +7,7 @@ describe AnalyticsStageSerializer do end let(:json) { serializer.as_json } - let(:resource) { Gitlab::CycleAnalytics::CodeStage.new(project: double, options: {}, stage: :code) } + let(:resource) { Gitlab::CycleAnalytics::CodeStage.new(project: double, options: {}) } before do allow_any_instance_of(Gitlab::CycleAnalytics::MetricsFetcher).to receive(:median).and_return(1.12) @@ -15,7 +15,7 @@ describe AnalyticsStageSerializer do end it 'it generates payload for single object' do - expect(json).to be_an_instance_of Hash + expect(json).to be_kind_of Hash end it 'contains important elements of AnalyticsStage' do diff --git a/spec/serializers/analytics_summary_serializer_spec.rb b/spec/serializers/analytics_summary_serializer_spec.rb index e08e3f88710..7a84c8b0b40 100644 --- a/spec/serializers/analytics_summary_serializer_spec.rb +++ b/spec/serializers/analytics_summary_serializer_spec.rb @@ -8,14 +8,19 @@ describe AnalyticsSummarySerializer do let(:json) { serializer.as_json } let(:project) { create(:empty_project) } - let(:resource) { Gitlab::CycleAnalytics::Summary::Issue.new(project: double, from: 1.day.ago) } + let(:user) { create(:user) } + let(:resource) do + Gitlab::CycleAnalytics::Summary::Issue.new(project: double, + from: 1.day.ago, + current_user: user) + end 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 + expect(json).to be_kind_of Hash end it 'contains important elements of AnalyticsStage' do |