Commit 5c605d50 authored by David H. Wilkins's avatar David H. Wilkins

Add tests for ReactiveCaching key cleanup

- ReactiveCaching should attempt deletion of value keys which do not
  have an associated alive key
parent 0c44c05b
...@@ -196,6 +196,12 @@ describe ReactiveCaching, :use_clean_rails_memory_store_caching do ...@@ -196,6 +196,12 @@ describe ReactiveCaching, :use_clean_rails_memory_store_caching do
2.times { instance.exclusively_update_reactive_cache! } 2.times { instance.exclusively_update_reactive_cache! }
end end
it 'does not delete the value key' do
expect(Rails.cache).to receive(:delete).with(cache_key).never
go!
end
context 'and #calculate_reactive_cache raises an exception' do context 'and #calculate_reactive_cache raises an exception' do
before do before do
stub_reactive_cache(instance, "preexisting") stub_reactive_cache(instance, "preexisting")
...@@ -223,6 +229,12 @@ describe ReactiveCaching, :use_clean_rails_memory_store_caching do ...@@ -223,6 +229,12 @@ describe ReactiveCaching, :use_clean_rails_memory_store_caching do
go! go!
end end
it 'deletes the value key' do
expect(Rails.cache).to receive(:delete).with(cache_key).once
go!
end
end end
context 'when the lease is already taken' do context 'when the lease is already taken' 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