Skip to content

Commit

Permalink
use response.parsed_body instead of JSON.parse when evaluating respon…
Browse files Browse the repository at this point in the history
…ses in tests
  • Loading branch information
lgebhardt committed Jan 22, 2024
1 parent a6c0b10 commit 75113ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions test/helpers/functional_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ module FunctionalHelpers
# end
#
def json_response
JSON.parse(@response.body)
@response.parsed_body

This comment has been minimized.

Copy link
@bf4

bf4 Jan 22, 2024

Collaborator

100

end
end
end
end
4 changes: 2 additions & 2 deletions test/integration/requests/request_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def test_post_polymorphic_with_has_many_relationship

assert_jsonapi_response 201

body = JSON.parse(response.body)
body = response.parsed_body
person = Person.find(body.dig("data", "id"))

assert_equal "Reo", person.name
Expand Down Expand Up @@ -649,7 +649,7 @@ def test_patch_polymorphic_with_has_many_relationship

assert_jsonapi_response 200

body = JSON.parse(response.body)
body = response.parsed_body
person = Person.find(body.dig("data", "id"))

assert_equal "Reo", person.name
Expand Down

0 comments on commit 75113ed

Please sign in to comment.