From da2f451f95b97ee2be77de52695be61553ebce52 Mon Sep 17 00:00:00 2001 From: Douglas Barbosa Alexandre Date: Tue, 25 Jun 2019 19:41:05 -0300 Subject: [PATCH] Set 2 weeks as the expiration time for the current broadcast message --- app/models/broadcast_message.rb | 2 +- spec/models/broadcast_message_spec.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/broadcast_message.rb b/app/models/broadcast_message.rb index 0fd8dca70b4..da4584228ce 100644 --- a/app/models/broadcast_message.rb +++ b/app/models/broadcast_message.rb @@ -45,7 +45,7 @@ class BroadcastMessage < ApplicationRecord end def self.cache_expires_in - nil + 2.weeks end def active? diff --git a/spec/models/broadcast_message_spec.rb b/spec/models/broadcast_message_spec.rb index 4d53e4aad8a..020ada3c47a 100644 --- a/spec/models/broadcast_message_spec.rb +++ b/spec/models/broadcast_message_spec.rb @@ -48,14 +48,14 @@ describe BroadcastMessage do expect(described_class.current).to be_empty end - it 'caches the output of the query' do + it 'caches the output of the query for two weeks' do create(:broadcast_message) - expect(described_class).to receive(:current_and_future_messages).and_call_original.once + expect(described_class).to receive(:current_and_future_messages).and_call_original.twice described_class.current - Timecop.travel(1.year) do + Timecop.travel(3.weeks) do described_class.current end end