Skip to content

Commit

Permalink
Add spec for marking all notifications as read
Browse files Browse the repository at this point in the history
  • Loading branch information
Freika committed Jul 4, 2024
1 parent ba265e3 commit 118c7b5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions spec/requests/notifications_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,21 @@
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

0 comments on commit 118c7b5

Please sign in to comment.