Update notification_finder_spec.rb

This commit is contained in:
Muhsin Keloth
2023-12-14 19:44:10 +05:30
parent ce339d0350
commit 340ba9bc53
+12 -3
View File
@@ -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