Add spec for marking all notifications as read

This commit is contained in:
Eugene Burmakin 2024-07-04 23:01:24 +02:00
parent ba265e3c26
commit 118c7b5704

View file

@ -56,5 +56,21 @@ RSpec.describe '/notifications', type: :request do
expect(response).to redirect_to(notifications_url)
end
end
describe 'POST /mark_as_read' do
let!(:notification) { create(:notification, user:, read_at: nil) }
it 'marks all notifications as read' do
post mark_notifications_as_read_url
expect(notification.reload.read_at).to be_present
end
it 'redirects to the notifications list' do
post mark_notifications_as_read_url
expect(response).to redirect_to(notifications_url)
end
end
end
end