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