jsonapi-rb / jsonapi-rails

Rails gem for fast jsonapi-compliant APIs.
http://jsonapi-rb.org
MIT License
318 stars 62 forks source link

Support Rails' `parsed_body` #140

Closed tagliala closed 1 year ago

tagliala commented 1 year ago

Hi, this enhancement can also be considered as an issue

There is a new RuboCop Rails cop that checks for the usage of parsed_body rubocop/rubocop-rails#863

Ref: https://api.rubyonrails.org/classes/ActionDispatch/TestResponse.html#method-i-parsed_body

I've noticed that out of the box JSON API does not convert parsed_body into a Hash

Compatibility has been added in Rails 6.0 via rails/rails#34717

Expected

response.parsed_body.class
Hash

Actual

response.parsed_body.class
String