Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2018-05-08 09:07:48 +0300
committerNick Thomas <nick@gitlab.com>2018-05-08 09:51:38 +0300
commit1f898f1e20a74b67faa931384c3fec33b5fd956f (patch)
tree4c2ae6b71b6b9af93f9c9cc2d871f40b529cb183 /spec/models/concerns
parent0eb74426b3eeacf92cd144e6ddc336adbe43ca1e (diff)
Update commit status from external CI services less aggressively
Diffstat (limited to 'spec/models/concerns')
-rw-r--r--spec/models/concerns/reactive_caching_spec.rb22
1 files changed, 15 insertions, 7 deletions
diff --git a/spec/models/concerns/reactive_caching_spec.rb b/spec/models/concerns/reactive_caching_spec.rb
index a5d505af001..4570dbb1d8e 100644
--- a/spec/models/concerns/reactive_caching_spec.rb
+++ b/spec/models/concerns/reactive_caching_spec.rb
@@ -29,12 +29,6 @@ describe ReactiveCaching, :use_clean_rails_memory_store_caching do
end
end
- let(:now) { Time.now.utc }
-
- around do |example|
- Timecop.freeze(now) { example.run }
- end
-
let(:calculation) { -> { 2 + 2 } }
let(:cache_key) { "foo:666" }
let(:instance) { CacheTest.new(666, &calculation) }
@@ -49,13 +43,15 @@ describe ReactiveCaching, :use_clean_rails_memory_store_caching do
context 'when cache is empty' do
it { is_expected.to be_nil }
- it 'queues a background worker' do
+ it 'enqueues a background worker to bootstrap the cache' do
expect(ReactiveCachingWorker).to receive(:perform_async).with(CacheTest, 666)
go!
end
it 'updates the cache lifespan' do
+ expect(reactive_cache_alive?(instance)).to be_falsy
+
go!
expect(reactive_cache_alive?(instance)).to be_truthy
@@ -69,6 +65,18 @@ describe ReactiveCaching, :use_clean_rails_memory_store_caching do
it { is_expected.to eq(2) }
+ it 'does not enqueue a background worker' do
+ expect(ReactiveCachingWorker).not_to receive(:perform_async)
+
+ go!
+ end
+
+ it 'updates the cache lifespan' do
+ expect(Rails.cache).to receive(:write).with(alive_reactive_cache_key(instance), true, expires_in: anything)
+
+ go!
+ end
+
context 'and expired' do
before do
invalidate_reactive_cache(instance)