Add JSON support for GET /my/pins with no pagination and tests.

This commit is contained in:
Denis Švara
2026-01-14 17:43:16 +01:00
parent 1d8b765bab
commit e82dc08f6c
3 changed files with 23 additions and 1 deletions
@@ -11,4 +11,14 @@ class My::PinsControllerTest < ActionDispatch::IntegrationTest
assert_response :success
assert_select "div", text: /#{users(:kevin).pins.first.card.title}/
end
test "index as JSON" do
expected_ids = users(:kevin).pins.ordered.pluck(:card_id)
get my_pins_path(format: :json)
assert_response :success
assert_equal expected_ids.count, @response.parsed_body.count
assert_equal expected_ids, @response.parsed_body.map { |card| card["id"] }
end
end