diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 04:45:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 04:45:44 +0300 |
commit | 85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch) | |
tree | 9160f299afd8c80c038f08e1545be119f5e3f1e1 /spec/lib/gitlab/external_authorization | |
parent | 15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff) |
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'spec/lib/gitlab/external_authorization')
-rw-r--r-- | spec/lib/gitlab/external_authorization/access_spec.rb | 10 | ||||
-rw-r--r-- | spec/lib/gitlab/external_authorization/cache_spec.rb | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/spec/lib/gitlab/external_authorization/access_spec.rb b/spec/lib/gitlab/external_authorization/access_spec.rb index 4bb81230ac0..a6773cc19e1 100644 --- a/spec/lib/gitlab/external_authorization/access_spec.rb +++ b/spec/lib/gitlab/external_authorization/access_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Gitlab::ExternalAuthorization::Access, :clean_gitlab_redis_cache 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 @@ -19,7 +19,7 @@ RSpec.describe Gitlab::ExternalAuthorization::Access, :clean_gitlab_redis_cache 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 @@ -70,7 +70,7 @@ RSpec.describe Gitlab::ExternalAuthorization::Access, :clean_gitlab_redis_cache 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) @@ -118,7 +118,7 @@ RSpec.describe Gitlab::ExternalAuthorization::Access, :clean_gitlab_redis_cache 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 @@ -129,7 +129,7 @@ RSpec.describe Gitlab::ExternalAuthorization::Access, :clean_gitlab_redis_cache 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 diff --git a/spec/lib/gitlab/external_authorization/cache_spec.rb b/spec/lib/gitlab/external_authorization/cache_spec.rb index 9037c04cf2b..a8e7932b82c 100644 --- a/spec/lib/gitlab/external_authorization/cache_spec.rb +++ b/spec/lib/gitlab/external_authorization/cache_spec.rb @@ -22,7 +22,7 @@ RSpec.describe Gitlab::ExternalAuthorization::Cache, :clean_gitlab_redis_cache d 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) @@ -38,7 +38,7 @@ RSpec.describe Gitlab::ExternalAuthorization::Cache, :clean_gitlab_redis_cache d 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') |