Skip to content

Commit e4c9707

Browse files
authored
fix: railtie to use correct load hook (#1438)
* chore: fix file typo * fix: railtie to use correct load hook
1 parent 311b1fe commit e4c9707

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

lib/jsonapi/resources/railtie.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,15 @@ class Railtie < ::Rails::Railtie
77
load 'tasks/check_upgrade.rake'
88
end
99

10-
11-
initializer "jsonapi_resources.testing", after: :initialize do
12-
next unless Rails.env.test?
10+
# https://guides.rubyonrails.org/v6.0/engines.html#available-hooks
11+
ActiveSupport.on_load(:action_dispatch_integration_test) do
1312
# Make response.parsed_body work
14-
ActionDispatch::IntegrationTest.register_encoder :api_json,
13+
::ActionDispatch::IntegrationTest.register_encoder :api_json,
1514
param_encoder: ->(params) {
1615
params
1716
},
1817
response_parser: ->(body) {
19-
JSONAPI::MimeTypes.parser.call(body)
18+
::JSONAPI::MimeTypes.parser.call(body)
2019
}
2120
end
2221
end

0 commit comments

Comments
 (0)