Add JSON support for GET /my/pins with no pagination and tests.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user