From 340ba9bc5391f0c34702350108c135d3230cd4b7 Mon Sep 17 00:00:00 2001 From: Muhsin Keloth Date: Thu, 14 Dec 2023 19:44:10 +0530 Subject: [PATCH] Update notification_finder_spec.rb --- spec/finders/notification_finder_spec.rb | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/spec/finders/notification_finder_spec.rb b/spec/finders/notification_finder_spec.rb index abee7f202..f00d6ef6e 100644 --- a/spec/finders/notification_finder_spec.rb +++ b/spec/finders/notification_finder_spec.rb @@ -7,9 +7,9 @@ describe NotificationFinder do let!(:user) { create(:user, account: account) } before do - create(:notification, account: account, user: user) - create(:notification, account: account, user: user) - create(:notification, account: account, user: user, snoozed_until: DateTime.now.utc + 1.day) + create(:notification, account: account, user: user, updated_at: DateTime.now.utc + 1.day) + create(:notification, account: account, user: user, snoozed_until: DateTime.now.utc + 3.days, updated_at: DateTime.now.utc) + create(:notification, account: account, user: user, updated_at: DateTime.now.utc + 2.days) end describe '#perform' do @@ -30,5 +30,14 @@ describe NotificationFinder do expect(result.length).to be 3 end end + + context 'when order by updated_at' do + let(:params) { { status: 'open' } } + + it 'returns all notifications' do + result = notification_finder.perform + expect(result.first.updated_at).to be > result.last.updated_at + end + end end end