Commit 488ffdf4 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'ali/remove-usages-of-timecop' into 'master'

Remove some usages of Timecop.freeze

See merge request gitlab-org/gitlab!46375
parents 5bdd3c1f 0317af90
......@@ -1113,60 +1113,13 @@ Rails/SaveBang:
# Cop supports --auto-correct.
RSpec/TimecopFreeze:
Exclude:
- 'ee/spec/controllers/admin/application_settings_controller_spec.rb'
- 'ee/spec/controllers/projects/security/network_policies_controller_spec.rb'
- 'ee/spec/features/admin/admin_reset_pipeline_minutes_spec.rb'
- 'ee/spec/features/boards/sidebar_spec.rb'
- 'ee/spec/features/groups/analytics/cycle_analytics/filters_and_data_spec.rb'
- 'ee/spec/features/groups/iteration_spec.rb'
- 'ee/spec/features/projects/mirror_spec.rb'
- 'ee/spec/features/projects/services/prometheus_custom_metrics_spec.rb'
- 'ee/spec/finders/productivity_analytics_finder_spec.rb'
- 'ee/spec/frontend/fixtures/analytics.rb'
- 'ee/spec/helpers/vulnerabilities_helper_spec.rb'
- 'ee/spec/lib/analytics/merge_request_metrics_refresh_spec.rb'
- 'ee/spec/lib/analytics/productivity_analytics_request_params_spec.rb'
- 'ee/spec/lib/ee/gitlab/background_migration/populate_vulnerability_historical_statistics_spec.rb'
- 'ee/spec/lib/gitlab/analytics/cycle_analytics/data_collector_spec.rb'
- 'ee/spec/lib/gitlab/analytics/cycle_analytics/group_stage_time_summary_spec.rb'
- 'ee/spec/lib/gitlab/analytics/cycle_analytics/summary/group/stage_time_summary_spec.rb'
- 'ee/spec/lib/gitlab/analytics/type_of_work/tasks_by_type_spec.rb'
- 'ee/spec/lib/gitlab/auth/group_saml/sso_enforcer_spec.rb'
- 'ee/spec/lib/gitlab/database/load_balancing/host_spec.rb'
- 'ee/spec/lib/gitlab/geo/base_request_spec.rb'
- 'ee/spec/lib/gitlab/geo/event_gap_tracking_spec.rb'
- 'ee/spec/lib/gitlab/geo/git_push_http_spec.rb'
- 'ee/spec/lib/gitlab/geo/log_cursor/daemon_spec.rb'
- 'ee/spec/lib/gitlab/geo/log_cursor/events/repository_updated_event_spec.rb'
- 'ee/spec/lib/gitlab/analytics/cycle_analytics/data_collector_spec.rb'
- 'ee/spec/lib/gitlab/geo/oauth/login_state_spec.rb'
- 'ee/spec/lib/gitlab/insights/reducers/count_per_period_reducer_spec.rb'
- 'ee/spec/lib/gitlab/prometheus/queries/additional_metrics_environment_query_spec.rb'
- 'ee/spec/lib/gitlab/prometheus/queries/cluster_query_spec.rb'
- 'ee/spec/migrations/populate_vulnerability_historical_statistics_for_year_spec.rb'
- 'ee/spec/migrations/remove_duplicated_cs_findings_spec.rb'
- 'ee/spec/migrations/remove_duplicated_cs_findings_without_vulnerability_id_spec.rb'
- 'ee/spec/migrations/schedule_fix_orphan_promoted_issues_spec.rb'
- 'ee/spec/migrations/schedule_merge_request_any_approval_rule_migration_spec.rb'
- 'ee/spec/migrations/schedule_populate_resolved_on_default_branch_column_spec.rb'
- 'ee/spec/migrations/schedule_populate_vulnerability_historical_statistics_spec.rb'
- 'ee/spec/migrations/schedule_project_any_approval_rule_migration_spec.rb'
- 'ee/spec/migrations/set_resolved_state_on_vulnerabilities_spec.rb'
- 'ee/spec/migrations/20190926180443_schedule_epic_issues_after_epics_move_spec.rb'
- 'ee/spec/models/analytics/cycle_analytics/group_level_spec.rb'
- 'ee/spec/models/burndown_spec.rb'
- 'ee/spec/models/ee/namespace_spec.rb'
- 'ee/spec/models/geo/project_registry_spec.rb'
- 'ee/spec/models/merge_train_spec.rb'
- 'ee/spec/models/productivity_analytics_spec.rb'
- 'ee/spec/models/project_spec.rb'
- 'ee/spec/models/vulnerabilities/export_spec.rb'
- 'ee/spec/requests/api/vulnerabilities_spec.rb'
- 'ee/spec/services/geo/file_download_service_spec.rb'
- 'ee/spec/services/vulnerabilities/confirm_service_spec.rb'
- 'ee/spec/services/vulnerabilities/dismiss_service_spec.rb'
- 'ee/spec/services/vulnerabilities/resolve_service_spec.rb'
- 'ee/spec/services/vulnerabilities/revert_to_detected_service_spec.rb'
- 'ee/spec/services/vulnerability_exports/export_service_spec.rb'
- 'ee/spec/frontend/fixtures/analytics.rb'
- 'ee/spec/support/shared_contexts/lib/gitlab/insights/reducers/reducers_shared_contexts.rb'
- 'qa/spec/support/repeater_spec.rb'
- 'spec/features/profiles/active_sessions_spec.rb'
......
......@@ -298,7 +298,7 @@ RSpec.describe Admin::ApplicationSettingsController do
let_it_be(:current_count) { 10 }
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
before_all do
......
......@@ -73,7 +73,7 @@ RSpec.describe Projects::Security::NetworkPoliciesController do
end
it 'returns network policies summary' do
Timecop.freeze do
freeze_time do
expect(adapter).to(
receive(:query)
.with(:packet_flow, kubernetes_namespace, "minute", 1.hour.ago.to_s, Time.current.to_s)
......@@ -114,7 +114,7 @@ RSpec.describe Projects::Security::NetworkPoliciesController do
end
it 'queries with default arguments' do
Timecop.freeze do
freeze_time do
expect(adapter).to(
receive(:query)
.with(:packet_flow, kubernetes_namespace, "minute", 1.hour.ago.to_s, Time.current.to_s)
......
......@@ -18,7 +18,7 @@ RSpec.describe 'Reset namespace pipeline minutes', :js do
it 'resets pipeline minutes' do
time = Time.now
Timecop.freeze(time) do
travel_to(time) do
click_button 'Reset pipeline minutes'
end
......
......@@ -22,7 +22,7 @@ RSpec.describe 'Issue Boards', :js do
let(:card2) { find('.board:nth-child(2)').find('.board-card:nth-child(1)') }
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
before do
......
......@@ -284,7 +284,7 @@ RSpec.describe 'Group value stream analytics filters and data', :js do
let_it_be(:issue) { create(:issue, project: project, created_at: 5.days.ago) }
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
before do
......
......@@ -13,7 +13,7 @@ RSpec.describe 'Group iterations' do
let_it_be(:user) { create(:group_member, :maintainer, user: create(:user), group: group ).user }
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
before do
......
......@@ -52,7 +52,7 @@ RSpec.describe 'Project mirror', :js do
context 'when able to force update' do
it 'forces import' do
Timecop.freeze(timestamp) do
travel_to(timestamp) do
visit project_mirror_path(project)
end
......@@ -72,7 +72,7 @@ RSpec.describe 'Project mirror', :js do
let(:disabled_updating_button) { '[data-qa-selector="updating_button"].disabled' }
it 'disables Update now button' do
Timecop.freeze(timestamp) do
travel_to(timestamp) do
visit project_mirror_path(project)
end
......
......@@ -10,7 +10,7 @@ RSpec.describe 'Prometheus custom metrics', :js do
let!(:prometheus_metric) { create(:prometheus_metric, project: project) }
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
before do
......
......@@ -35,7 +35,7 @@ RSpec.describe ProductivityAnalyticsFinder do
let(:search_params) { { days_to_merge: [30] } }
it 'returns all MRs with merged_at - created_at IN specified values' do
Timecop.freeze do
freeze_time do
long_mr
short_mr
expect(subject.execute).to match_array([long_mr])
......@@ -51,7 +51,7 @@ RSpec.describe ProductivityAnalyticsFinder do
end
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
context 'with merged_after specified as timestamp' do
......
......@@ -52,7 +52,7 @@ RSpec.describe VulnerabilitiesHelper do
end
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
it 'has expected vulnerability properties' do
......
......@@ -6,7 +6,7 @@ RSpec.describe Analytics::MergeRequestMetricsRefresh do
subject { calculator_class.new(merge_request) }
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
let(:calculator_class) do
......
......@@ -68,7 +68,7 @@ RSpec.describe Analytics::ProductivityAnalyticsRequestParams do
describe 'default values' do
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
describe '`merged_before`' do
......
......@@ -31,7 +31,7 @@ RSpec.describe Gitlab::BackgroundMigration::PopulateVulnerabilityHistoricalStati
end
around do |example|
Timecop.freeze(Date.parse('2020-07-28')) { example.run }
travel_to(Date.parse('2020-07-28')) { example.run }
end
before do
......
......@@ -13,7 +13,7 @@ RSpec.describe Gitlab::Analytics::CycleAnalytics::GroupStageTimeSummary do
subject { described_class.new(group, options: options).data }
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
describe '#lead_time' do
......
......@@ -12,7 +12,7 @@ RSpec.describe Gitlab::Analytics::CycleAnalytics::Summary::Group::StageTimeSumma
subject { described_class.new(group, options: { from: from, to: to, current_user: user }).data }
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
describe '#lead_time' do
......
......@@ -27,7 +27,7 @@ RSpec.describe Gitlab::Analytics::TypeOfWork::TasksByType do
end
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
before do
......
......@@ -24,7 +24,7 @@ RSpec.describe Gitlab::Auth::GroupSaml::SsoEnforcer do
end
it 'stores the current time for later comparison' do
Timecop.freeze do
freeze_time do
subject.update_session
expect(session[:active_group_sso_sign_ins][saml_provider.id]).to eq DateTime.now
......@@ -58,7 +58,7 @@ RSpec.describe Gitlab::Auth::GroupSaml::SsoEnforcer do
subject.update_session
days_after_timeout = Gitlab::Auth::GroupSaml::SsoEnforcer::DEFAULT_SESSION_TIMEOUT + 2.days
Timecop.freeze(days_after_timeout) do
travel_to(days_after_timeout.from_now) do
expect(subject).not_to be_active_session
end
end
......
......@@ -195,7 +195,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::Host do
end
it 'returns false when we do not need to check the replica status' do
Timecop.freeze do
freeze_time do
allow(host)
.to receive(:last_checked_at)
.and_return(Time.zone.now)
......
......@@ -25,7 +25,7 @@ RSpec.describe Gitlab::Geo::BaseRequest, :geo do
end
it 'defaults to 1-minute expiration time' do
Timecop.freeze do
freeze_time do
expect(jwt.first['exp']).to eq((Time.now + 1.minute).to_i)
end
end
......
......@@ -79,7 +79,7 @@ RSpec.describe Gitlab::Geo::EventGapTracking, :clean_gitlab_redis_cache do
describe '#fill_gaps' do
it 'ignore gaps that are less than 10 minutes old' do
Timecop.freeze do
freeze_time do
gap_tracking.check!(event_id_with_gap)
expect { |blk| gap_tracking.fill_gaps(&blk) }.not_to yield_with_args(anything)
......@@ -145,7 +145,7 @@ RSpec.describe Gitlab::Geo::EventGapTracking, :clean_gitlab_redis_cache do
end
it 'saves the gap id in redis' do
Timecop.freeze do
freeze_time do
gap_tracking.send(:track_gaps, event_id_with_gap)
expect(read_gaps).to contain_exactly([gap_id.to_s, Time.now.to_i])
......@@ -153,7 +153,7 @@ RSpec.describe Gitlab::Geo::EventGapTracking, :clean_gitlab_redis_cache do
end
it 'saves a range of gaps id in redis' do
Timecop.freeze do
freeze_time do
gap_tracking.send(:track_gaps, event_id_with_gap + 3)
expected_gaps = ((previous_event_id + 1)..(event_id_with_gap + 2)).collect { |id| [id.to_s, Time.now.to_i] }
......@@ -165,7 +165,7 @@ RSpec.describe Gitlab::Geo::EventGapTracking, :clean_gitlab_redis_cache do
it 'saves the gaps in order' do
expected_gaps = []
Timecop.freeze do
freeze_time do
gap_tracking.send(:track_gaps, event_id_with_gap)
expected_gaps << [gap_id.to_s, Time.now.to_i]
end
......
......@@ -68,7 +68,7 @@ RSpec.describe Gitlab::Geo::LogCursor::Events::RepositoryUpdatedEvent, :clean_gi
end
it 'sets resync_repository_was_scheduled_at to the scheduled time' do
Timecop.freeze do
freeze_time do
subject.process
reloaded_registry = registry.reload
......@@ -100,7 +100,7 @@ RSpec.describe Gitlab::Geo::LogCursor::Events::RepositoryUpdatedEvent, :clean_gi
end
it 'sets resync_wiki_was_scheduled_at to the scheduled time' do
Timecop.freeze do
freeze_time do
subject.process
reloaded_registry = registry.reload
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe Gitlab::Prometheus::Queries::AdditionalMetricsEnvironmentQuery do
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
include_examples 'additional custom metrics query' do
......
......@@ -8,7 +8,7 @@ RSpec.describe Gitlab::Prometheus::Queries::ClusterQuery do
subject { described_class.new(client) }
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
it 'load cluster metrics from yaml' do
......
......@@ -44,7 +44,7 @@ RSpec.describe ScheduleEpicIssuesAfterEpicsMove do
it 'schedules background migrations at correct time', :aggregate_failures do
Sidekiq::Testing.fake! do
Timecop.freeze do
freeze_time do
migrate!
expect(described_class::MIGRATION).to(
......
......@@ -33,7 +33,7 @@ RSpec.describe PopulateVulnerabilityHistoricalStatisticsForYear do
stub_const("#{described_class.name}::BATCH_SIZE", 1)
Sidekiq::Testing.fake! do
Timecop.freeze do
freeze_time do
migrate!
expect(described_class::MIGRATION)
......@@ -56,7 +56,7 @@ RSpec.describe PopulateVulnerabilityHistoricalStatisticsForYear do
create_project(2)
Sidekiq::Testing.fake! do
Timecop.freeze do
freeze_time do
migrate!
expect(BackgroundMigrationWorker.jobs.size).to eq(0)
......
......@@ -24,7 +24,7 @@ RSpec.describe RemoveDuplicatedCsFindings, :migration do
end
around do |example|
Timecop.freeze { Sidekiq::Testing.fake! { example.run } }
freeze_time { Sidekiq::Testing.fake! { example.run } }
end
it 'updates location fingerprint for containter scanning findings', :sidekiq_might_not_need_inline do
......
......@@ -26,7 +26,7 @@ RSpec.describe RemoveDuplicatedCsFindingsWithoutVulnerabilityId, :migration do
end
around do |example|
Timecop.freeze { Sidekiq::Testing.fake! { example.run } }
freeze_time { Sidekiq::Testing.fake! { example.run } }
end
it 'removes duplicate findings and vulnerabilities' do
......
......@@ -15,7 +15,7 @@ RSpec.describe ScheduleFixOrphanPromotedIssues do
stub_const("#{described_class.name}::BATCH_SIZE", 2)
Sidekiq::Testing.fake! do
Timecop.freeze do
freeze_time do
migrate!
expect(described_class::BACKGROUND_MIGRATION).to be_scheduled_migration(promote_orphan_1_note.id)
......
......@@ -35,7 +35,7 @@ RSpec.describe ScheduleMergeRequestAnyApprovalRuleMigration do
stub_const("#{described_class.name}::BATCH_SIZE", 2)
Sidekiq::Testing.fake! do
Timecop.freeze do
freeze_time do
migrate!
expect(described_class::MIGRATION)
......@@ -58,7 +58,7 @@ RSpec.describe ScheduleMergeRequestAnyApprovalRuleMigration do
create_merge_request(2)
Sidekiq::Testing.fake! do
Timecop.freeze do
freeze_time do
migrate!
expect(BackgroundMigrationWorker.jobs.size).to eq(0)
......
......@@ -9,7 +9,7 @@ RSpec.describe SchedulePopulateResolvedOnDefaultBranchColumn do
end
around do |example|
Timecop.freeze { Sidekiq::Testing.fake! { example.run } }
freeze_time { Sidekiq::Testing.fake! { example.run } }
end
context 'when the Gitlab instance is CE' do
......
......@@ -33,7 +33,7 @@ RSpec.describe SchedulePopulateVulnerabilityHistoricalStatistics do
stub_const("#{described_class.name}::BATCH_SIZE", 1)
Sidekiq::Testing.fake! do
Timecop.freeze do
freeze_time do
migrate!
expect(described_class::MIGRATION)
......@@ -56,7 +56,7 @@ RSpec.describe SchedulePopulateVulnerabilityHistoricalStatistics do
create_project(2)
Sidekiq::Testing.fake! do
Timecop.freeze do
freeze_time do
migrate!
expect(BackgroundMigrationWorker.jobs.size).to eq(0)
......
......@@ -30,7 +30,7 @@ RSpec.describe ScheduleProjectAnyApprovalRuleMigration do
stub_const("#{described_class.name}::BATCH_SIZE", 2)
Sidekiq::Testing.fake! do
Timecop.freeze do
freeze_time do
migrate!
expect(described_class::MIGRATION)
......@@ -53,7 +53,7 @@ RSpec.describe ScheduleProjectAnyApprovalRuleMigration do
create_project(2)
Sidekiq::Testing.fake! do
Timecop.freeze do
freeze_time do
migrate!
expect(BackgroundMigrationWorker.jobs.size).to eq(0)
......
......@@ -134,7 +134,7 @@ RSpec.describe SetResolvedStateOnVulnerabilities do
describe '#up' do
it 'sets "resolved" state only for resolved vulnerabilities' do
Timecop.freeze do
freeze_time do
migrate!
expect(find(vulnerability_open_id)).to have_attributes(state: states[:opened], resolved_by_id: nil, resolved_at: nil)
......
......@@ -13,7 +13,7 @@ RSpec.describe Analytics::CycleAnalytics::GroupLevel do
let(:pipeline) { create(:ci_empty_pipeline, status: 'created', project: project, ref: mr.source_branch, sha: mr.source_branch_sha, head_pipeline_of: mr) }
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
subject { described_class.new(group: group, options: { from: from_date, current_user: user }) }
......
......@@ -223,7 +223,7 @@ RSpec.describe Burndown do
end
it 'avoids N+1 database queries' do
Timecop.freeze(milestone.due_date) do
travel_to(milestone.due_date) do
create(:issue, milestone: milestone, weight: 2, project: project, author: user)
control_count = ActiveRecord::QueryRecorder.new(skip_cached: false) do
......
......@@ -1752,7 +1752,7 @@ RSpec.describe Namespace do
it 'sets a date' do
namespace = build(:namespace)
Timecop.freeze do
freeze_time do
namespace.enable_temporary_storage_increase!
expect(namespace.temporary_storage_increase_ends_on).to eq(30.days.from_now.to_date)
......
......@@ -550,7 +550,7 @@ RSpec.describe Geo::ProjectRegistry, :geo do
describe '#start_sync!' do
around do |example|
Timecop.freeze do
freeze_time do
example.run
end
end
......@@ -609,7 +609,7 @@ RSpec.describe Geo::ProjectRegistry, :geo do
end
it 'sets last_repository_successful_sync_at to now' do
Timecop.freeze do
freeze_time do
subject.finish_sync!(type)
expect(subject.reload.last_repository_successful_sync_at).to be_within(1).of(Time.current)
......@@ -704,7 +704,7 @@ RSpec.describe Geo::ProjectRegistry, :geo do
end
it 'sets last_wiki_successful_sync_at to now' do
Timecop.freeze do
freeze_time do
subject.finish_sync!(type)
expect(subject.reload.last_wiki_successful_sync_at).to be_within(1).of(Time.current)
......
......@@ -125,7 +125,7 @@ RSpec.describe ProductivityAnalytics do
end
before do
Timecop.freeze do
freeze_time do
long_mr
medium_mr
short_mr
......
......@@ -353,7 +353,7 @@ RSpec.describe Project do
it 'creates import_state and sets next_execution_timestamp to now' do
project = build(:project, :mirror, creator: create(:user))
Timecop.freeze do
freeze_time do
expect do
project.save!
end.to change { ProjectImportState.count }.by(1)
......@@ -368,7 +368,7 @@ RSpec.describe Project do
it 'creates import_state and sets next_execution_timestamp to now' do
project = create(:project)
Timecop.freeze do
freeze_time do
expect do
project.update(mirror: true, mirror_user_id: project.creator.id, import_url: generate(:url))
end.to change { ProjectImportState.count }.by(1)
......@@ -382,7 +382,7 @@ RSpec.describe Project do
it 'sets current import_state next_execution_timestamp to now' do
project = create(:project, import_url: generate(:url))
Timecop.freeze do
freeze_time do
expect do
project.update(mirror: true, mirror_user_id: project.creator.id)
end.not_to change { ProjectImportState.count }
......
......@@ -72,7 +72,7 @@ RSpec.describe Vulnerabilities::Export do
subject(:vulnerability_export) { create(:vulnerability_export, :csv) }
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
context 'when the export is new' do
......
......@@ -192,7 +192,7 @@ RSpec.describe API::Vulnerabilities do
end
it 'dismisses a vulnerability and its associated findings' do
Timecop.freeze do
freeze_time do
dismiss_vulnerability
expect(response).to have_gitlab_http_status(:created)
......@@ -279,7 +279,7 @@ RSpec.describe API::Vulnerabilities do
end
it 'resolves a vulnerability and its associated findings' do
Timecop.freeze do
freeze_time do
resolve_vulnerability
expect(response).to have_gitlab_http_status(:created)
......@@ -336,7 +336,7 @@ RSpec.describe API::Vulnerabilities do
end
it 'confirms a vulnerability and its associated findings' do
Timecop.freeze do
freeze_time do
confirm_vulnerability
expect(response).to have_gitlab_http_status(:created)
......@@ -394,7 +394,7 @@ RSpec.describe API::Vulnerabilities do
end
it 'reverts a vulnerability and its associated findings to detected state' do
Timecop.freeze do
freeze_time do
revert_vulnerability_to_detected
expect(response).to have_gitlab_http_status(:created)
......
......@@ -194,7 +194,7 @@ RSpec.describe Geo::FileDownloadService do
end
it 'sets a retry date and increments the retry count' do
Timecop.freeze do
freeze_time do
execute!
expect(registry.last.reload.retry_count).to eq(1)
......@@ -223,7 +223,7 @@ RSpec.describe Geo::FileDownloadService do
end
it 'sets a retry date and increments the retry count' do
Timecop.freeze do
freeze_time do
execute!
expect(registry.last.reload.retry_count).to eq(1)
......@@ -315,7 +315,7 @@ RSpec.describe Geo::FileDownloadService do
end
it 'sets a retry date and increments the retry count' do
Timecop.freeze do
freeze_time do
execute!
expect(registry_entry.reload.retry_count).to eq(4)
......@@ -326,7 +326,7 @@ RSpec.describe Geo::FileDownloadService do
it 'sets a retry date with a maximum of about 7 days' do
registry_entry.update!(retry_count: 100, retry_at: 7.days.from_now)
Timecop.freeze do
freeze_time do
execute!
expect(registry_entry.reload.retry_at < 8.days.from_now).to be_truthy
......@@ -354,7 +354,7 @@ RSpec.describe Geo::FileDownloadService do
end
it 'sets a retry date and increments the retry count' do
Timecop.freeze do
freeze_time do
execute!
expect(registry_entry.reload.retry_count).to eq(4)
......@@ -365,7 +365,7 @@ RSpec.describe Geo::FileDownloadService do
it 'sets a retry date with a maximum of about 7 days' do
registry_entry.update!(retry_count: 100, retry_at: 7.days.from_now)
Timecop.freeze do
freeze_time do
execute!
expect(registry_entry.reload.retry_at < 8.days.from_now).to be_truthy
......
......@@ -25,7 +25,7 @@ RSpec.describe Vulnerabilities::ConfirmService do
it_behaves_like 'removes dismissal feedback from associated findings'
it 'confirms a vulnerability' do
Timecop.freeze do
freeze_time do
confirm_vulnerability
expect(vulnerability.reload).to(
......
......@@ -30,7 +30,7 @@ RSpec.describe Vulnerabilities::DismissService do
let(:dismiss_findings) { false }
it 'dismisses only vulnerability' do
Timecop.freeze do
freeze_time do
dismiss_vulnerability
expect(vulnerability.reload).to(
......@@ -42,7 +42,7 @@ RSpec.describe Vulnerabilities::DismissService do
context 'when the `dismiss_findings` argument is not false' do
it 'dismisses a vulnerability and its associated findings' do
Timecop.freeze do
freeze_time do
dismiss_vulnerability
expect(vulnerability.reload).to(
......@@ -57,7 +57,7 @@ RSpec.describe Vulnerabilities::DismissService do
let(:service) { described_class.new(user, vulnerability, comment) }
it 'dismisses a vulnerability and its associated findings with comment', :aggregate_failures do
Timecop.freeze do
freeze_time do
dismiss_vulnerability
aggregate_failures do
......
......@@ -25,7 +25,7 @@ RSpec.describe Vulnerabilities::ResolveService do
it_behaves_like 'removes dismissal feedback from associated findings'
it 'resolves a vulnerability' do
Timecop.freeze do
freeze_time do
resolve_vulnerability
expect(vulnerability.reload).to(
......
......@@ -18,7 +18,7 @@ RSpec.describe Vulnerabilities::RevertToDetectedService do
shared_examples 'reverts vulnerability' do
it 'reverts a vulnerability and its associated findings to detected state' do
Timecop.freeze do
freeze_time do
revert_vulnerability_to_detected
expect(vulnerability.reload).to(
......
......@@ -112,7 +112,7 @@ RSpec.describe VulnerabilityExports::ExportService do
end
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
it 'calls the VulnerabilityExports::Exporters::CsvService which sets the file and filename' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment