From e73c8232de3719319e793f024a65c3a300f06b0c Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Thu, 30 Apr 2020 10:33:11 +0200 Subject: [PATCH] Improve unit test in cache_service_spec --- spec/services/cache_service_spec.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/services/cache_service_spec.rb b/spec/services/cache_service_spec.rb index 22a6e2b772..b609711bc6 100644 --- a/spec/services/cache_service_spec.rb +++ b/spec/services/cache_service_spec.rb @@ -22,7 +22,7 @@ describe CacheService do before do rails_cache.stub(:fetch) - CacheService.stub(:latest_timestamp_by_class) { timestamp } + allow(Enterprise).to receive(:maximum).with(:updated_at).and_return(timestamp) end it "caches data by timestamp for last record of that class" do @@ -30,7 +30,6 @@ describe CacheService do "TEST" end - expect(CacheService).to have_received(:latest_timestamp_by_class).with(Enterprise) expect(rails_cache).to have_received(:fetch).with("test-cache-key-Enterprise-#{timestamp}") end end