Skip to content

Commit

Permalink
fix: railtie to use correct load hook (#1438)
Browse files Browse the repository at this point in the history
* chore: fix file typo

* fix: railtie to use correct load hook
  • Loading branch information
bf4 authored Jan 24, 2024
1 parent 311b1fe commit e4c9707
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
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
# 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

0 comments on commit e4c9707

Please sign in to comment.