diff options
Diffstat (limited to 'spec/support/helpers/reactive_caching_helpers.rb')
-rw-r--r-- | spec/support/helpers/reactive_caching_helpers.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/spec/support/helpers/reactive_caching_helpers.rb b/spec/support/helpers/reactive_caching_helpers.rb index aa9d3b3a199..0b0b0622696 100644 --- a/spec/support/helpers/reactive_caching_helpers.rb +++ b/spec/support/helpers/reactive_caching_helpers.rb @@ -10,8 +10,11 @@ module ReactiveCachingHelpers end def stub_reactive_cache(subject = nil, data = nil, *qualifiers) - allow(ReactiveCachingWorker).to receive(:perform_async) - allow(ReactiveCachingWorker).to receive(:perform_in) + ReactiveCaching::WORK_TYPE.values.each do |worker| + allow(worker).to receive(:perform_async) + allow(worker).to receive(:perform_in) + end + write_reactive_cache(subject, data, *qualifiers) unless subject.nil? end @@ -42,8 +45,8 @@ module ReactiveCachingHelpers Rails.cache.write(alive_reactive_cache_key(subject, *qualifiers), true) end - def expect_reactive_cache_update_queued(subject) - expect(ReactiveCachingWorker) + def expect_reactive_cache_update_queued(subject, worker_klass: ReactiveCachingWorker) + expect(worker_klass) .to receive(:perform_in) .with(subject.class.reactive_cache_refresh_interval, subject.class, subject.id) end |