mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
Replace load hook :active_model_serializers with :action_controller
This commit is contained in:
parent
ea8d463555
commit
d3bdc9be57
@ -24,4 +24,4 @@ preferably inside an initializer.
|
|||||||
|
|
||||||
## Hooks
|
## Hooks
|
||||||
|
|
||||||
To run a hook when ActiveModelSerializers is loaded, use `ActiveSupport.on_load(:active_model_serializers) do end`
|
To run a hook when ActiveModelSerializers is loaded, use `ActiveSupport.on_load(:action_controller) do end`
|
||||||
|
|||||||
@ -28,12 +28,6 @@ class RailtieTest < ActiveSupport::TestCase
|
|||||||
assert_equal ActionController::Base.cache_store, ActiveModelSerializers.config.cache_store
|
assert_equal ActionController::Base.cache_store, ActiveModelSerializers.config.cache_store
|
||||||
assert_equal Rails.configuration.action_controller.perform_caching, ActiveModelSerializers.config.perform_caching
|
assert_equal Rails.configuration.action_controller.perform_caching, ActiveModelSerializers.config.perform_caching
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'it runs the load hook' do
|
|
||||||
loaded = false
|
|
||||||
ActiveSupport.on_load(:active_model_serializers) { loaded = true }
|
|
||||||
assert loaded
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class WithoutRails < RailtieTest
|
class WithoutRails < RailtieTest
|
||||||
@ -59,11 +53,5 @@ class RailtieTest < ActiveSupport::TestCase
|
|||||||
refute Rails.configuration.action_controller.perform_caching
|
refute Rails.configuration.action_controller.perform_caching
|
||||||
refute ActiveModelSerializers.config.perform_caching
|
refute ActiveModelSerializers.config.perform_caching
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it hasn't run the load hook" do
|
|
||||||
loaded = false
|
|
||||||
ActiveSupport.on_load(:active_model_serializers) { loaded = true }
|
|
||||||
refute loaded
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user