Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions lib/jsonapi/resources/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ class Railtie < ::Rails::Railtie
load 'tasks/check_upgrade.rake'
end


initializer "jsonapi_resources.testing", after: :initialize do
next unless Rails.env.test?
# https://guides.rubyonrails.org/v6.0/engines.html#available-hooks
ActiveSupport.on_load(:action_dispatch_integration_test) do
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lgebhardt this should have used this load hook

# Make response.parsed_body work
ActionDispatch::IntegrationTest.register_encoder :api_json,
::ActionDispatch::IntegrationTest.register_encoder :api_json,
param_encoder: ->(params) {
params
},
response_parser: ->(body) {
JSONAPI::MimeTypes.parser.call(body)
::JSONAPI::MimeTypes.parser.call(body)
}
end
end
Expand Down