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:
Benjamin Fleischer
2015-09-18 10:19:40 -05:00
parent a30913229f
commit ad2ca3b45c
13 changed files with 75 additions and 58 deletions

View File

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