Commit fc5df2d4 authored by Rémy Coutable's avatar Rémy Coutable

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

Remove some usages of Timecop.freeze [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!48190
parents 53815d6c 32e086bf
......@@ -695,14 +695,10 @@ RSpec/TimecopFreeze:
- 'ee/spec/services/vulnerability_exports/export_service_spec.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'
- 'spec/features/projects/environments/environment_metrics_spec.rb'
- 'spec/features/users/active_sessions_spec.rb'
- 'spec/lib/atlassian/jira_connect/client_spec.rb'
- 'spec/lib/gitlab/analytics/cycle_analytics/base_query_builder_spec.rb'
- 'spec/lib/gitlab/analytics/cycle_analytics/median_spec.rb'
- 'spec/lib/gitlab/analytics/cycle_analytics/records_fetcher_spec.rb'
- 'spec/lib/gitlab/anonymous_session_spec.rb'
- 'spec/lib/gitlab/auth/unique_ips_limiter_spec.rb'
- 'spec/lib/gitlab/checks/timed_logger_spec.rb'
- 'spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb'
......@@ -715,10 +711,6 @@ RSpec/TimecopFreeze:
- 'spec/lib/rspec_flaky/flaky_example_spec.rb'
- 'spec/lib/rspec_flaky/listener_spec.rb'
- 'spec/models/active_session_spec.rb'
- 'spec/models/container_repository_spec.rb'
- 'spec/models/pages/lookup_path_spec.rb'
- 'spec/models/project_feature_usage_spec.rb'
- 'spec/requests/api/v3/github_spec.rb'
- 'spec/serializers/entity_date_helper_spec.rb'
- 'spec/support/cycle_analytics_helpers/test_generation.rb'
- 'spec/support/helpers/cycle_analytics_helpers.rb'
......
......@@ -12,7 +12,7 @@ RSpec.describe 'Profile > Active Sessions', :clean_gitlab_redis_shared_state do
let(:admin) { create(:admin) }
it 'User sees their active sessions' do
Timecop.freeze(Time.zone.parse('2018-03-12 09:06')) do
travel_to(Time.zone.parse('2018-03-12 09:06')) do
Capybara::Session.new(:session1)
Capybara::Session.new(:session2)
Capybara::Session.new(:session3)
......
......@@ -22,7 +22,7 @@ RSpec.describe 'Environment > Metrics' do
end
around do |example|
Timecop.freeze(current_time) { example.run }
travel_to(current_time) { example.run }
end
shared_examples 'has environment selector' do
......
......@@ -8,7 +8,7 @@ RSpec.describe Atlassian::JiraConnect::Client do
subject { described_class.new('https://gitlab-test.atlassian.net', 'sample_secret') }
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
describe '.generate_update_sequence_id' do
......
......@@ -22,7 +22,7 @@ RSpec.describe Gitlab::AnonymousSession, :clean_gitlab_redis_shared_state do
end
it 'adds expiration time to key' do
Timecop.freeze do
freeze_time do
subject.count_session_ip
Gitlab::Redis::SharedState.with do |redis|
......
......@@ -188,7 +188,7 @@ RSpec.describe ContainerRepository do
subject { repository.start_expiration_policy! }
it 'sets the expiration policy started at to now' do
Timecop.freeze do
freeze_time do
expect { subject }
.to change { repository.expiration_policy_started_at }.from(nil).to(Time.zone.now)
end
......
......@@ -65,7 +65,7 @@ RSpec.describe Pages::LookupPath do
end
it 'uses deployment from object storage' do
Timecop.freeze do
freeze_time do
expect(source).to(
eq({
type: 'zip',
......@@ -85,7 +85,7 @@ RSpec.describe Pages::LookupPath do
end
it 'uses file protocol' do
Timecop.freeze do
freeze_time do
expect(source).to(
eq({
type: 'zip',
......
......@@ -25,7 +25,7 @@ RSpec.describe ProjectFeatureUsage, type: :model do
subject { project.feature_usage }
it 'logs Jira DVCS Cloud last sync' do
Timecop.freeze do
freeze_time do
subject.log_jira_dvcs_integration_usage
expect(subject.jira_dvcs_server_last_sync_at).to be_nil
......@@ -34,7 +34,7 @@ RSpec.describe ProjectFeatureUsage, type: :model do
end
it 'logs Jira DVCS Server last sync' do
Timecop.freeze do
freeze_time do
subject.log_jira_dvcs_integration_usage(cloud: false)
expect(subject.jira_dvcs_server_last_sync_at).to be_like_time(Time.current)
......
......@@ -383,7 +383,7 @@ RSpec.describe API::V3::Github do
it 'counts Jira Cloud integration as enabled' do
user_agent = 'Jira DVCS Connector Vertigo/4.42.0'
Timecop.freeze do
freeze_time do
jira_get v3_api("/repos/#{project.namespace.path}/#{project.path}/branches", user), user_agent
expect(project.reload.jira_dvcs_cloud_last_sync_at).to be_like_time(Time.now)
......@@ -393,7 +393,7 @@ RSpec.describe API::V3::Github do
it 'counts Jira Server integration as enabled' do
user_agent = 'Jira DVCS Connector/3.2.4'
Timecop.freeze do
freeze_time do
jira_get v3_api("/repos/#{project.namespace.path}/#{project.path}/branches", user), user_agent
expect(project.reload.jira_dvcs_server_last_sync_at).to be_like_time(Time.now)
......
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