Add JSON response support for notifications/tray.

This commit is contained in:
Denis Švara
2026-01-19 13:51:14 +01:00
committed by Alp Keser
parent ee4511180a
commit 0b9869f3c9
2 changed files with 10 additions and 0 deletions
@@ -11,4 +11,13 @@ class Notifications::TraysControllerTest < ActionDispatch::IntegrationTest
assert_response :success
assert_select "div", text: /Layout is broken/
end
test "show as JSON" do
expected_ids = users(:kevin).notifications.unread.ordered.limit(100).pluck(:id)
get tray_notifications_path(format: :json)
assert_response :success
assert_equal expected_ids, @response.parsed_body.map { |notification| notification["id"] }
end
end