diff options
-rw-r--r-- | app/services/base_count_service.rb | 8 | ||||
-rw-r--r-- | spec/services/base_count_service_spec.rb | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/app/services/base_count_service.rb b/app/services/base_count_service.rb index 7ded81b98ca..19873fe09a5 100644 --- a/app/services/base_count_service.rb +++ b/app/services/base_count_service.rb @@ -9,7 +9,7 @@ class BaseCountService end def count - Rails.cache.fetch(cache_key, cache_options({ raw: raw? })) { uncached_count }.to_i + Rails.cache.fetch(cache_key, cache_options) { uncached_count }.to_i end def refresh_cache @@ -33,8 +33,8 @@ class BaseCountService end # subclasses can override to add any specific options, such as - # options[:expires_in] = 5.minutes - def cache_options(options) - options + # super.merge({ expires_in: 5.minutes }) + def cache_options + { raw: raw? } end end diff --git a/spec/services/base_count_service_spec.rb b/spec/services/base_count_service_spec.rb index 8cf0f6ce584..090b2dcdd43 100644 --- a/spec/services/base_count_service_spec.rb +++ b/spec/services/base_count_service_spec.rb @@ -79,8 +79,8 @@ describe BaseCountService, :use_clean_rails_memory_store_caching do end describe '#cache_options' do - it 'returns the passed in options' do - expect(service.cache_options({ raw: true })).to eq({ raw: true }) + it 'returns the default in options' do + expect(service.cache_options).to eq({ raw: false }) end end end |