Skip to content
Snippets Groups Projects
Unverified Commit 18aec09e authored by Alishan Ladhani's avatar Alishan Ladhani
Browse files

Run autocorrection for RSpec/TimecopFreeze

Only on spec directory
parent 4b56bc52
No related branches found
No related tags found
No related merge requests found
Showing
with 31 additions and 31 deletions
Loading
Loading
@@ -44,7 +44,7 @@
 
context 'when anonymous users can read build report results' do
it 'sets the daily coverage options' do
Timecop.freeze do
freeze_time do
get(:charts, params: { namespace_id: project.namespace.path, project_id: project.path, id: 'master' })
 
expect(assigns[:daily_coverage_options]).to eq(
Loading
Loading
Loading
Loading
@@ -98,7 +98,7 @@
let(:page_2_boundary) { microseconds(page_2.last.updated_at + NotesFinder::FETCH_OVERLAP) }
 
around do |example|
Timecop.freeze do
freeze_time do
example.run
end
end
Loading
Loading
Loading
Loading
@@ -23,7 +23,7 @@
let(:application_settings) { {} }
 
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
 
before do
Loading
Loading
Loading
Loading
@@ -8,7 +8,7 @@
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
Loading
Loading
Loading
Loading
@@ -112,7 +112,7 @@
let!(:group) { create(:group) }
 
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
 
before do
Loading
Loading
Loading
Loading
@@ -503,7 +503,7 @@ def sign_in_using_saml!
 
context 'within the grace period' do
it 'redirects to two-factor configuration page' do
Timecop.freeze do
freeze_time do
expect(authentication_metrics)
.to increment(:user_authenticated_counter)
 
Loading
Loading
Loading
Loading
@@ -45,7 +45,7 @@
let(:current_time) { Time.current.utc }
 
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
 
subject { parsed_payload.starts_at }
Loading
Loading
Loading
Loading
@@ -17,7 +17,7 @@
end
 
it 'logs time in UTC with ISO8601.3 standard' do
Timecop.freeze do
freeze_time do
expect(subject.format_message('INFO', Time.now, nil, string_message))
.to include(Time.now.utc.iso8601(3))
end
Loading
Loading
Loading
Loading
@@ -20,7 +20,7 @@
subject(:payload) { described_class.new(build, ttl: 30).payload }
 
it 'has correct values for the standard JWT attributes' do
Timecop.freeze do
freeze_time do
now = Time.now.to_i
 
aggregate_failures do
Loading
Loading
Loading
Loading
@@ -85,7 +85,7 @@ def build_jwt(access_token_id:, user_id:, expire_time: nil)
it 'returns the encoded JWT' do
allow(SecureRandom).to receive(:uuid).and_return('u-u-i-d')
 
Timecop.freeze do
freeze_time do
jwt = build_jwt(access_token_id: 123, user_id: 456)
 
token = described_class.new(access_token_id: 123, user_id: 456)
Loading
Loading
Loading
Loading
@@ -34,7 +34,7 @@
 
describe '#project_median' do
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
 
it 'counts median from issues with metrics' do
Loading
Loading
@@ -76,7 +76,7 @@
 
describe '#group_median' do
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
 
it 'counts median from issues with metrics' do
Loading
Loading
Loading
Loading
@@ -29,7 +29,7 @@
 
describe '#median' do
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
 
it 'counts median from issues with metrics' do
Loading
Loading
@@ -65,7 +65,7 @@
 
describe '#group_median' do
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
 
it 'counts median from issues with metrics' do
Loading
Loading
@@ -87,7 +87,7 @@
 
describe '#group_median' do
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
 
it 'counts median from issues with metrics' do
Loading
Loading
Loading
Loading
@@ -29,7 +29,7 @@
 
describe '#project_median' do
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
 
it 'counts median from issues with metrics' do
Loading
Loading
@@ -67,7 +67,7 @@
 
describe '#group_median' do
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
 
it 'counts median from issues with metrics' do
Loading
Loading
Loading
Loading
@@ -27,7 +27,7 @@
 
describe '#project_median' do
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
 
it 'counts median from issues with metrics' do
Loading
Loading
@@ -70,7 +70,7 @@
 
describe '#group_median' do
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
 
it 'counts median from issues with metrics' do
Loading
Loading
Loading
Loading
@@ -231,7 +231,7 @@ def includes_commits?(data)
 
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
 
Loading
Loading
Loading
Loading
@@ -32,7 +32,7 @@
 
describe '#project_median' do
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
 
it 'counts median from issues with metrics' do
Loading
Loading
@@ -79,7 +79,7 @@
 
describe '#group_median' do
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
 
it 'counts median from issues with metrics' do
Loading
Loading
Loading
Loading
@@ -37,7 +37,7 @@
end
 
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
 
it 'counts median from issues with metrics' do
Loading
Loading
Loading
Loading
@@ -86,7 +86,7 @@
let!(:id3) { create(:user).id }
 
around do |example|
Timecop.freeze { example.run }
freeze_time { example.run }
end
 
before do
Loading
Loading
Loading
Loading
@@ -7,7 +7,7 @@
 
describe '#loaded?' do
it 'is `true` when it was loaded recently' do
Timecop.freeze do
freeze_time do
allow(access).to receive(:loaded_at).and_return(5.minutes.ago)
 
expect(access).to be_loaded
Loading
Loading
@@ -19,7 +19,7 @@
end
 
it 'is `false` when there the result was loaded a long time ago' do
Timecop.freeze do
freeze_time do
allow(access).to receive(:loaded_at).and_return(2.weeks.ago)
 
expect(access).not_to be_loaded
Loading
Loading
@@ -70,7 +70,7 @@
end
 
it 'stores the result in redis' do
Timecop.freeze do
freeze_time do
fake_cache = double
expect(fake_cache).to receive(:store).with(true, nil, Time.now)
expect(access).to receive(:cache).and_return(fake_cache)
Loading
Loading
@@ -118,7 +118,7 @@
end
 
it 'does not load from the webservice' do
Timecop.freeze do
freeze_time do
expect(fake_cache).to receive(:load).and_return([true, nil, Time.now])
 
expect(access).to receive(:load_from_cache).and_call_original
Loading
Loading
@@ -129,7 +129,7 @@
end
 
it 'loads from the webservice when the cached result was too old' do
Timecop.freeze do
freeze_time do
expect(fake_cache).to receive(:load).and_return([true, nil, 2.days.ago])
 
expect(access).to receive(:load_from_cache).and_call_original
Loading
Loading
Loading
Loading
@@ -22,7 +22,7 @@ def set_in_redis(key, value)
 
describe '#load' do
it 'reads stored info from redis' do
Timecop.freeze do
freeze_time do
set_in_redis(:access, false)
set_in_redis(:reason, 'Access denied for now')
set_in_redis(:refreshed_at, Time.now)
Loading
Loading
@@ -38,7 +38,7 @@ def set_in_redis(key, value)
 
describe '#store' do
it 'sets the values in redis' do
Timecop.freeze do
freeze_time do
cache.store(true, 'the reason', Time.now)
 
expect(read_from_redis(:access)).to eq('true')
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment