mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
clean up lazy loading of serialization support for ActiveRecord::Base and ActionController::Base
This commit is contained in:
@@ -9,6 +9,8 @@ class RandomModelCollection
|
||||
end
|
||||
|
||||
module ActiveRecord
|
||||
class Base
|
||||
end
|
||||
class Relation
|
||||
end
|
||||
end
|
||||
@@ -26,5 +28,15 @@ class SerializerSupportTest < ActiveModel::TestCase
|
||||
ActiveSupport.run_load_hooks(:active_record)
|
||||
assert_equal ActiveModel::ArraySerializer, ActiveRecord::Relation.new.active_model_serializer
|
||||
end
|
||||
|
||||
test "it automatically includes serializer support in active_record/base" do
|
||||
ActiveSupport.run_load_hooks(:active_record)
|
||||
assert ActiveRecord::Base.new.respond_to?(:active_model_serializer)
|
||||
end
|
||||
|
||||
test "it automatically includes serializer support in action_controller/base" do
|
||||
ActiveSupport.run_load_hooks(:action_controller)
|
||||
assert ActionController::Base.new.respond_to?(:serialization_scope)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user