diff options
author | Adam Hegyi <ahegyi@gitlab.com> | 2019-08-06 14:39:56 +0300 |
---|---|---|
committer | Adam Hegyi <ahegyi@gitlab.com> | 2019-08-07 16:30:25 +0300 |
commit | c18fa976321ba857c6bc6387f47636618c035c64 (patch) | |
tree | 50c909982482f4735cb5ae3a898f71b0fccd3309 /spec/lib/gitlab/cycle_analytics/shared_stage_spec.rb | |
parent | 0a514100a69554681d11d41b583a1515e2246774 (diff) |
New Cycle Analytics backendnew-cycle-analytics-stage-backend
This change lays the foundation for customizable cycle analytics stages.
The main reason for the change is to extract the event definitions to
separate objects (start_event, end_event) so that it could be easily
customized later on.
In this commit the default stages that we provide in CE are migrated to
the new structure.
Diffstat (limited to 'spec/lib/gitlab/cycle_analytics/shared_stage_spec.rb')
-rw-r--r-- | spec/lib/gitlab/cycle_analytics/shared_stage_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/lib/gitlab/cycle_analytics/shared_stage_spec.rb b/spec/lib/gitlab/cycle_analytics/shared_stage_spec.rb index cf95741908f..29373b01603 100644 --- a/spec/lib/gitlab/cycle_analytics/shared_stage_spec.rb +++ b/spec/lib/gitlab/cycle_analytics/shared_stage_spec.rb @@ -32,3 +32,19 @@ shared_examples 'base stage' do expect(stage.events).not_to be_nil end end + +shared_examples 'using Gitlab::CycleAnalytics::DataCollector as backend' do + let(:stage_params) { Gitlab::CycleAnalytics::DefaultStages.send("params_for_#{stage_name}_stage").merge(project: project) } + let(:stage) { CycleAnalytics::ProjectStage.new(stage_params) } + let(:data_collector) { Gitlab::CycleAnalytics::DataCollector.new(stage, from: from, current_user: project.creator) } + + it 'provides the same median value' do + expect(data_collector.median.seconds).to eq(ISSUES_MEDIAN) + end + + it 'provides the same event records' do + records = data_collector.records_fetcher.serialized_records + expect(records.count).to eq(expected_record_count) + expect(records.map { |event| event[:title] }).to eq(expected_record_titles) + end +end |