Add JSON response support for notifications/tray.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
json.array! @notifications, partial: "notifications/notification", as: :notification
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user