diff options
Diffstat (limited to 'spec/lib/gitlab/cycle_analytics')
10 files changed, 13 insertions, 76 deletions
diff --git a/spec/lib/gitlab/cycle_analytics/code_stage_spec.rb b/spec/lib/gitlab/cycle_analytics/code_stage_spec.rb index afab19de2ab..17104715580 100644 --- a/spec/lib/gitlab/cycle_analytics/code_stage_spec.rb +++ b/spec/lib/gitlab/cycle_analytics/code_stage_spec.rb @@ -34,7 +34,7 @@ RSpec.describe Gitlab::CycleAnalytics::CodeStage do describe '#project_median' do around do |example| - Timecop.freeze { example.run } + freeze_time { example.run } end it 'counts median from issues with metrics' do @@ -76,7 +76,7 @@ RSpec.describe Gitlab::CycleAnalytics::CodeStage do describe '#group_median' do around do |example| - Timecop.freeze { example.run } + freeze_time { example.run } end it 'counts median from issues with metrics' do diff --git a/spec/lib/gitlab/cycle_analytics/events_spec.rb b/spec/lib/gitlab/cycle_analytics/events_spec.rb index 246003cde84..e0a8e2c17a3 100644 --- a/spec/lib/gitlab/cycle_analytics/events_spec.rb +++ b/spec/lib/gitlab/cycle_analytics/events_spec.rb @@ -306,48 +306,6 @@ RSpec.describe 'cycle analytics events' do end end - describe '#production_events', :sidekiq_might_not_need_inline do - let(:stage) { :production } - let!(:context) { create(:issue, project: project, created_at: 2.days.ago) } - - before do - merge_merge_requests_closing_issue(user, project, context) - deploy_master(user, project) - end - - it 'has the total time' do - expect(events.first[:total_time]).not_to be_empty - end - - it 'has a title' do - expect(events.first[:title]).to eq(context.title) - end - - it 'has the URL' do - expect(events.first[:url]).not_to be_nil - end - - it 'has an iid' do - expect(events.first[:iid]).to eq(context.iid.to_s) - end - - it 'has a created_at timestamp' do - expect(events.first[:created_at]).to end_with('ago') - end - - it "has the author's URL" do - expect(events.first[:author][:web_url]).not_to be_nil - end - - it "has the author's avatar URL" do - expect(events.first[:author][:avatar_url]).not_to be_nil - end - - it "has the author's name" do - expect(events.first[:author][:name]).to eq(context.author.name) - end - end - def setup(context) milestone = create(:milestone, project: project) context.update(milestone: milestone) diff --git a/spec/lib/gitlab/cycle_analytics/issue_stage_spec.rb b/spec/lib/gitlab/cycle_analytics/issue_stage_spec.rb index 9ec71e6ed72..c7ab2b9b84b 100644 --- a/spec/lib/gitlab/cycle_analytics/issue_stage_spec.rb +++ b/spec/lib/gitlab/cycle_analytics/issue_stage_spec.rb @@ -29,7 +29,7 @@ RSpec.describe Gitlab::CycleAnalytics::IssueStage do describe '#median' do around do |example| - Timecop.freeze { example.run } + freeze_time { example.run } end it 'counts median from issues with metrics' do @@ -65,7 +65,7 @@ RSpec.describe Gitlab::CycleAnalytics::IssueStage do describe '#group_median' do around do |example| - Timecop.freeze { example.run } + freeze_time { example.run } end it 'counts median from issues with metrics' do @@ -87,7 +87,7 @@ RSpec.describe Gitlab::CycleAnalytics::IssueStage do describe '#group_median' do around do |example| - Timecop.freeze { example.run } + freeze_time { example.run } end it 'counts median from issues with metrics' do diff --git a/spec/lib/gitlab/cycle_analytics/permissions_spec.rb b/spec/lib/gitlab/cycle_analytics/permissions_spec.rb index 3fd48993e5f..7650ff3cace 100644 --- a/spec/lib/gitlab/cycle_analytics/permissions_spec.rb +++ b/spec/lib/gitlab/cycle_analytics/permissions_spec.rb @@ -21,10 +21,6 @@ RSpec.describe Gitlab::CycleAnalytics::Permissions do expect(subject[:staging]).to eq(false) end - it 'has no permissions to production stage' do - expect(subject[:production]).to eq(false) - end - it 'has no permissions to code stage' do expect(subject[:code]).to eq(false) end @@ -55,10 +51,6 @@ RSpec.describe Gitlab::CycleAnalytics::Permissions do expect(subject[:staging]).to eq(true) end - it 'has permissions to production stage' do - expect(subject[:production]).to eq(true) - end - it 'has permissions to code stage' do expect(subject[:code]).to eq(true) end @@ -121,9 +113,5 @@ RSpec.describe Gitlab::CycleAnalytics::Permissions do it 'has no permissions to issue stage' do expect(subject[:issue]).to eq(false) end - - it 'has no permissions to production stage' do - expect(subject[:production]).to eq(false) - end end end diff --git a/spec/lib/gitlab/cycle_analytics/plan_stage_spec.rb b/spec/lib/gitlab/cycle_analytics/plan_stage_spec.rb index 66d00edacb7..2547c05c025 100644 --- a/spec/lib/gitlab/cycle_analytics/plan_stage_spec.rb +++ b/spec/lib/gitlab/cycle_analytics/plan_stage_spec.rb @@ -29,7 +29,7 @@ RSpec.describe Gitlab::CycleAnalytics::PlanStage do describe '#project_median' do around do |example| - Timecop.freeze { example.run } + freeze_time { example.run } end it 'counts median from issues with metrics' do @@ -67,7 +67,7 @@ RSpec.describe Gitlab::CycleAnalytics::PlanStage do describe '#group_median' do around do |example| - Timecop.freeze { example.run } + freeze_time { example.run } end it 'counts median from issues with metrics' do diff --git a/spec/lib/gitlab/cycle_analytics/production_stage_spec.rb b/spec/lib/gitlab/cycle_analytics/production_stage_spec.rb deleted file mode 100644 index 73b17194f72..00000000000 --- a/spec/lib/gitlab/cycle_analytics/production_stage_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Gitlab::CycleAnalytics::ProductionStage do - let(:stage_name) { 'Total' } - - it_behaves_like 'base stage' -end diff --git a/spec/lib/gitlab/cycle_analytics/review_stage_spec.rb b/spec/lib/gitlab/cycle_analytics/review_stage_spec.rb index cdd1cca6837..5593013740e 100644 --- a/spec/lib/gitlab/cycle_analytics/review_stage_spec.rb +++ b/spec/lib/gitlab/cycle_analytics/review_stage_spec.rb @@ -27,7 +27,7 @@ RSpec.describe Gitlab::CycleAnalytics::ReviewStage do describe '#project_median' do around do |example| - Timecop.freeze { example.run } + freeze_time { example.run } end it 'counts median from issues with metrics' do @@ -70,7 +70,7 @@ RSpec.describe Gitlab::CycleAnalytics::ReviewStage do describe '#group_median' do around do |example| - Timecop.freeze { example.run } + freeze_time { example.run } end it 'counts median from issues with metrics' do diff --git a/spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb b/spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb index 9ece24074e7..719d4a69985 100644 --- a/spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb +++ b/spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb @@ -231,7 +231,7 @@ RSpec.describe Gitlab::CycleAnalytics::StageSummary do context 'when `from` and `to` are within a day' do it 'returns the number of deployments made on that day' do - Timecop.freeze(Time.now) do + freeze_time do create(:deployment, :success, project: project) options[:from] = options[:to] = Time.now diff --git a/spec/lib/gitlab/cycle_analytics/staging_stage_spec.rb b/spec/lib/gitlab/cycle_analytics/staging_stage_spec.rb index 69e42adb139..852f7041dc6 100644 --- a/spec/lib/gitlab/cycle_analytics/staging_stage_spec.rb +++ b/spec/lib/gitlab/cycle_analytics/staging_stage_spec.rb @@ -32,7 +32,7 @@ RSpec.describe Gitlab::CycleAnalytics::StagingStage do describe '#project_median' do around do |example| - Timecop.freeze { example.run } + freeze_time { example.run } end it 'counts median from issues with metrics' do @@ -79,7 +79,7 @@ RSpec.describe Gitlab::CycleAnalytics::StagingStage do describe '#group_median' do around do |example| - Timecop.freeze { example.run } + freeze_time { example.run } end it 'counts median from issues with metrics' do diff --git a/spec/lib/gitlab/cycle_analytics/test_stage_spec.rb b/spec/lib/gitlab/cycle_analytics/test_stage_spec.rb index 9a207d32167..49ee6624260 100644 --- a/spec/lib/gitlab/cycle_analytics/test_stage_spec.rb +++ b/spec/lib/gitlab/cycle_analytics/test_stage_spec.rb @@ -37,7 +37,7 @@ RSpec.describe Gitlab::CycleAnalytics::TestStage do end around do |example| - Timecop.freeze { example.run } + freeze_time { example.run } end it 'counts median from issues with metrics' do |