mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Remove Adapter autoloads in favor of require
Adapters must be eager loaded to ensure they are defined
before they are used as namespacing.
cf6a074a1c (diff-41f2b3509d33e1c65bb70ee0ec7a2eea)
This commit is contained in:
@@ -5,11 +5,6 @@ module ActiveModel
|
||||
|
||||
def setup
|
||||
@previous_adapter = ActiveModel::Serializer.config.adapter
|
||||
# Eager load adapters
|
||||
ActiveModel::Serializer::Adapter.eager_load!
|
||||
[:json_api, :attributes, :null, :json].each do |adapter_name|
|
||||
ActiveModel::Serializer::Adapter.lookup(adapter_name)
|
||||
end
|
||||
end
|
||||
|
||||
def teardown
|
||||
@@ -66,12 +61,13 @@ module ActiveModel
|
||||
|
||||
def test_adapter_map
|
||||
expected_adapter_map = {
|
||||
'null'.freeze => ActiveModel::Serializer::Adapter::Null,
|
||||
'json'.freeze => ActiveModel::Serializer::Adapter::Json,
|
||||
'json_api'.freeze => ActiveModel::Serializer::Adapter::JsonApi,
|
||||
'attributes'.freeze => ActiveModel::Serializer::Adapter::Attributes,
|
||||
'null'.freeze => ActiveModel::Serializer::Adapter::Null
|
||||
'json_api'.freeze => ActiveModel::Serializer::Adapter::JsonApi
|
||||
}
|
||||
assert_equal ActiveModel::Serializer::Adapter.adapter_map, expected_adapter_map
|
||||
actual = ActiveModel::Serializer::Adapter.adapter_map
|
||||
assert_equal actual, expected_adapter_map
|
||||
end
|
||||
|
||||
def test_adapters
|
||||
|
||||
Reference in New Issue
Block a user