diff options
author | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
commit | 6438df3a1e0fb944485cebf07976160184697d72 (patch) | |
tree | 00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /spec/lib/gitlab/cycle_analytics/review_stage_spec.rb | |
parent | 42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff) | |
download | gitlab-ce-6438df3a1e0fb944485cebf07976160184697d72.tar.gz |
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'spec/lib/gitlab/cycle_analytics/review_stage_spec.rb')
-rw-r--r-- | spec/lib/gitlab/cycle_analytics/review_stage_spec.rb | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/spec/lib/gitlab/cycle_analytics/review_stage_spec.rb b/spec/lib/gitlab/cycle_analytics/review_stage_spec.rb deleted file mode 100644 index 5593013740e..00000000000 --- a/spec/lib/gitlab/cycle_analytics/review_stage_spec.rb +++ /dev/null @@ -1,90 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Gitlab::CycleAnalytics::ReviewStage do - let(:stage_name) { :review } - let(:project) { create(:project) } - let(:issue_1) { create(:issue, project: project, created_at: 90.minutes.ago) } - let(:issue_2) { create(:issue, project: project, created_at: 60.minutes.ago) } - let(:issue_3) { create(:issue, project: project, created_at: 60.minutes.ago) } - let(:mr_1) { create(:merge_request, :closed, source_project: project, created_at: 60.minutes.ago) } - let(:mr_2) { create(:merge_request, :closed, source_project: project, created_at: 40.minutes.ago, source_branch: 'A') } - let(:mr_3) { create(:merge_request, source_project: project, created_at: 10.minutes.ago, source_branch: 'B') } - let!(:mr_4) { create(:merge_request, source_project: project, created_at: 10.minutes.ago, source_branch: 'C') } - let(:stage) { described_class.new(options: { from: 2.days.ago, current_user: project.creator, project: project }) } - - before do - mr_1.metrics.update!(merged_at: 30.minutes.ago) - mr_2.metrics.update!(merged_at: 10.minutes.ago) - - create(:merge_requests_closing_issues, merge_request: mr_1, issue: issue_1) - create(:merge_requests_closing_issues, merge_request: mr_2, issue: issue_2) - create(:merge_requests_closing_issues, merge_request: mr_3, issue: issue_3) - end - - it_behaves_like 'base stage' - - describe '#project_median' do - around do |example| - freeze_time { example.run } - end - - it 'counts median from issues with metrics' do - expect(stage.project_median).to eq(ISSUES_MEDIAN) - end - end - - describe '#events' do - subject { stage.events } - - it 'exposes merge requests that close issues' do - expect(subject.count).to eq(2) - expect(subject.map { |event| event[:title] }).to contain_exactly(mr_1.title, mr_2.title) - end - end - - context 'when group is given' do - let(:user) { create(:user) } - let(:group) { create(:group) } - let(:project_2) { create(:project, group: group) } - let(:project_3) { create(:project, group: group) } - let(:issue_2_1) { create(:issue, project: project_2, created_at: 90.minutes.ago) } - let(:issue_2_2) { create(:issue, project: project_3, created_at: 60.minutes.ago) } - let(:issue_2_3) { create(:issue, project: project_2, created_at: 60.minutes.ago) } - let(:mr_2_1) { create(:merge_request, :closed, source_project: project_2, created_at: 60.minutes.ago) } - let(:mr_2_2) { create(:merge_request, :closed, source_project: project_3, created_at: 40.minutes.ago, source_branch: 'A') } - let(:mr_2_3) { create(:merge_request, source_project: project_2, created_at: 10.minutes.ago, source_branch: 'B') } - let!(:mr_2_4) { create(:merge_request, source_project: project_3, created_at: 10.minutes.ago, source_branch: 'C') } - let(:stage) { described_class.new(options: { from: 2.days.ago, current_user: user, group: group }) } - - before do - group.add_owner(user) - mr_2_1.metrics.update!(merged_at: 30.minutes.ago) - mr_2_2.metrics.update!(merged_at: 10.minutes.ago) - - create(:merge_requests_closing_issues, merge_request: mr_2_1, issue: issue_2_1) - create(:merge_requests_closing_issues, merge_request: mr_2_2, issue: issue_2_2) - create(:merge_requests_closing_issues, merge_request: mr_2_3, issue: issue_2_3) - end - - describe '#group_median' do - around do |example| - freeze_time { example.run } - end - - it 'counts median from issues with metrics' do - expect(stage.group_median).to eq(ISSUES_MEDIAN) - end - end - - describe '#events' do - subject { stage.events } - - it 'exposes merge requests that close issues' do - expect(subject.count).to eq(2) - expect(subject.map { |event| event[:title] }).to contain_exactly(mr_2_1.title, mr_2_2.title) - end - end - end -end |