Files
fizzy/test/controllers/notifications/bulk_readings_controller_test.rb
Stanko K.R. 36ee253a1a Stack notifications everywhere
We had client-side notification stacking in the tray since launch, but now we want to stack notifications in the notifications page, in API responses and in email bundles.
2026-02-12 10:29:50 +01:00

36 lines
1.1 KiB
Ruby

require "test_helper"
class Notifications::BulkReadingsControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in_as :kevin
end
test "create marks all notifications as read" do
assert_changes -> { notifications(:logo_assignment_kevin).reload.read? }, from: false, to: true do
assert_changes -> { notifications(:layout_commented_kevin).reload.read? }, from: false, to: true do
post bulk_reading_path
end
end
end
test "create redirects to notifications path when not from tray" do
post bulk_reading_path
assert_redirected_to notifications_path
end
test "create returns ok when from tray" do
post bulk_reading_path, params: { from_tray: true }
assert_response :ok
end
test "create as JSON" do
assert_changes -> { notifications(:logo_assignment_kevin).reload.read? }, from: false, to: true do
assert_changes -> { notifications(:layout_commented_kevin).reload.read? }, from: false, to: true do
post bulk_reading_path, as: :json
end
end
assert_response :no_content
end
end