Correct card URL in comment JSON output
When rendering details of a comment, we were using the card's `id` as the param for the URL. But card routes use the card's number, not ID.
This commit is contained in:
@@ -13,9 +13,9 @@ json.cache! comment do
|
||||
|
||||
json.card do
|
||||
json.id comment.card_id
|
||||
json.url card_url(comment.card_id)
|
||||
json.url card_url(comment.card)
|
||||
end
|
||||
|
||||
json.reactions_url card_comment_reactions_url(comment.card_id, comment.id)
|
||||
json.url card_comment_url(comment.card_id, comment.id)
|
||||
json.reactions_url card_comment_reactions_url(comment.card, comment)
|
||||
json.url card_comment_url(comment.card, comment)
|
||||
end
|
||||
|
||||
@@ -78,9 +78,9 @@ class Cards::CommentsControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_response :success
|
||||
assert_equal comment.id, @response.parsed_body["id"]
|
||||
assert_equal comment.card.id, @response.parsed_body.dig("card", "id")
|
||||
assert_equal card_url(comment.card.id), @response.parsed_body.dig("card", "url")
|
||||
assert_equal card_comment_reactions_url(comment.card_id, comment.id), @response.parsed_body["reactions_url"]
|
||||
assert_equal card_comment_url(comment.card_id, comment.id), @response.parsed_body["url"]
|
||||
assert_equal card_url(comment.card), @response.parsed_body.dig("card", "url")
|
||||
assert_equal card_comment_reactions_url(comment.card, comment), @response.parsed_body["reactions_url"]
|
||||
assert_equal card_comment_url(comment.card, comment), @response.parsed_body["url"]
|
||||
end
|
||||
|
||||
test "update as JSON" do
|
||||
|
||||
Reference in New Issue
Block a user