summaryrefslogtreecommitdiff
path: root/spec/models/concerns
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-26 15:08:56 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-26 15:08:56 +0000
commit17ab40ca089e1aef61a83f77ab6df62a72f6ce06 (patch)
tree8eb149293eee90ec2750b6ac5e46a111a806424e /spec/models/concerns
parent66d4203791a01fdedf668a78818a229ea2c07aad (diff)
downloadgitlab-ce-17ab40ca089e1aef61a83f77ab6df62a72f6ce06.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/concerns')
-rw-r--r--spec/models/concerns/reactive_caching_spec.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/models/concerns/reactive_caching_spec.rb b/spec/models/concerns/reactive_caching_spec.rb
index 6d4eeae641f..96a9c317fb8 100644
--- a/spec/models/concerns/reactive_caching_spec.rb
+++ b/spec/models/concerns/reactive_caching_spec.rb
@@ -112,6 +112,43 @@ describe ReactiveCaching, :use_clean_rails_memory_store_caching do
end
end
+ describe '#with_reactive_cache_set', :use_clean_rails_redis_caching do
+ subject(:go!) do
+ instance.with_reactive_cache_set('resource', {}) do |data|
+ data
+ end
+ end
+
+ it 'calls with_reactive_cache' do
+ expect(instance)
+ .to receive(:with_reactive_cache)
+
+ go!
+ end
+
+ context 'data returned' do
+ let(:resource) { 'resource' }
+ let(:set_key) { "#{cache_key}:#{resource}" }
+ let(:set_cache) { Gitlab::ReactiveCacheSetCache.new }
+
+ before do
+ stub_reactive_cache(instance, true, resource, {})
+ end
+
+ it 'saves keys in set' do
+ expect(set_cache.read(set_key)).to be_empty
+
+ go!
+
+ expect(set_cache.read(set_key)).not_to be_empty
+ end
+
+ it 'returns the data' do
+ expect(go!).to eq(true)
+ end
+ end
+ end
+
describe '.reactive_cache_worker_finder' do
context 'with default reactive_cache_worker_finder' do
let(:args) { %w(other args) }