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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-12-09 17:23:09 +0300
committerJames Lopez <james@jameslopez.es>2017-01-17 13:32:55 +0300
commit30c6703f0afbf570ca3e3613a55afcbc7094c4eb (patch)
treeec7b891bb58f8d6b3bf8108e50ca8d791b4e6e09 /spec/lib/gitlab/cycle_analytics
parent982d5a050667c517bbc996a08ca0922f2c5fbfb4 (diff)
fix specs
Diffstat (limited to 'spec/lib/gitlab/cycle_analytics')
-rw-r--r--spec/lib/gitlab/cycle_analytics/plan_event_fetcher_spec.rb2
-rw-r--r--spec/lib/gitlab/cycle_analytics/shared_event_spec.rb13
-rw-r--r--spec/lib/gitlab/cycle_analytics/shared_stage_spec.rb10
3 files changed, 5 insertions, 20 deletions
diff --git a/spec/lib/gitlab/cycle_analytics/plan_event_fetcher_spec.rb b/spec/lib/gitlab/cycle_analytics/plan_event_fetcher_spec.rb
index 1c3c1728fc6..2e5dc5b5547 100644
--- a/spec/lib/gitlab/cycle_analytics/plan_event_fetcher_spec.rb
+++ b/spec/lib/gitlab/cycle_analytics/plan_event_fetcher_spec.rb
@@ -7,7 +7,7 @@ describe Gitlab::CycleAnalytics::PlanEventFetcher do
it_behaves_like 'default query config' do
context 'no commits' do
it 'does not blow up if there are no commits' do
- allow_any_instance_of(Gitlab::CycleAnalytics::MetricsFetcher).to receive(:events).and_return([{}])
+ allow(event).to receive(:event_result).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 03b013ffae8..9c5e57342e9 100644
--- a/spec/lib/gitlab/cycle_analytics/shared_event_spec.rb
+++ b/spec/lib/gitlab/cycle_analytics/shared_event_spec.rb
@@ -1,18 +1,11 @@
require 'spec_helper'
shared_examples 'default query config' do
- let(:fetcher) do
- Gitlab::CycleAnalytics::MetricsFetcher.new(project: create(:empty_project),
- from: 1.day.ago,
- branch: nil,
- stage: stage_name)
- end
-
- let(project)
- let(:event) { described_class.new(project: project, stage: stage_name, options: {}) }
+ let(:project) { create(:empty_project) }
+ let(:event) { described_class.new(project: project, stage: stage_name, options: { from: 1.day.ago }) }
it 'has the stage attribute' do
- expect(event.name).not_to be_nil
+ expect(event.stage).not_to be_nil
end
it 'has the projection attributes' do
diff --git a/spec/lib/gitlab/cycle_analytics/shared_stage_spec.rb b/spec/lib/gitlab/cycle_analytics/shared_stage_spec.rb
index c88e3e22f5c..6f3883d80f8 100644
--- a/spec/lib/gitlab/cycle_analytics/shared_stage_spec.rb
+++ b/spec/lib/gitlab/cycle_analytics/shared_stage_spec.rb
@@ -4,18 +4,10 @@ shared_examples 'base stage' do
let(:stage) { described_class.new(project: double, options: {}) }
before do
- allow_any_instance_of(Gitlab::CycleAnalytics::MetricsFetcher).to receive(:median).and_return(1.12)
+ allow(stage).to receive(:median).and_return(1.12)
allow_any_instance_of(Gitlab::CycleAnalytics::BaseEventFetcher).to receive(:event_result).and_return({})
end
- it 'has the start attributes' do
- expect(stage.start_time_attrs).not_to be_nil
- end
-
- it 'has the end attributes' do
- expect(stage.end_time_attrs).not_to be_nil
- end
-
it 'has the median data value' do
expect(stage.median_data[:value]).not_to be_nil
end