Replace load hook :active_model_serializers with :action_controller

This commit is contained in:
Benjamin Fleischer 2016-01-15 01:51:28 -06:00
parent ea8d463555
commit d3bdc9be57
2 changed files with 1 additions and 13 deletions

View File

@ -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`

View File

@ -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