mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
Improve Coverage
This commit is contained in:
parent
35a7c81034
commit
253205bb49
@ -7,9 +7,11 @@ module ActiveModel
|
||||
deprecate :inherited, 'ActiveModelSerializers::Adapter::Base.'
|
||||
end
|
||||
|
||||
# :nocov:
|
||||
def initialize(serializer, options = {})
|
||||
super(ActiveModelSerializers::Adapter::Base.new(serializer, options))
|
||||
end
|
||||
# :nocov:
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -2,9 +2,6 @@ module ActiveModel
|
||||
class Serializer
|
||||
# @api private
|
||||
class BelongsToReflection < SingularReflection
|
||||
def macro
|
||||
:belongs_to
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -2,9 +2,6 @@ module ActiveModel
|
||||
class Serializer
|
||||
# @api private
|
||||
class HasManyReflection < CollectionReflection
|
||||
def macro
|
||||
:has_many
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -2,9 +2,6 @@ module ActiveModel
|
||||
class Serializer
|
||||
# @api private
|
||||
class HasOneReflection < SingularReflection
|
||||
def macro
|
||||
:has_one
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -5,11 +5,13 @@ module ActiveModelSerializers
|
||||
private_constant :ADAPTER_MAP if defined?(private_constant)
|
||||
|
||||
class << self # All methods are class functions
|
||||
# :nocov:
|
||||
def new(*args)
|
||||
fail ArgumentError, 'Adapters inherit from Adapter::Base.' \
|
||||
"Adapter.new called with args: '#{args.inspect}', from" \
|
||||
"'caller[0]'."
|
||||
end
|
||||
# :nocov:
|
||||
|
||||
def configured_adapter
|
||||
lookup(ActiveModelSerializers.config.adapter)
|
||||
|
||||
@ -6,8 +6,10 @@ module ActiveModelSerializers
|
||||
Adapter::JsonApi::Deserialization.parse(*args)
|
||||
end
|
||||
|
||||
# :nocov:
|
||||
def jsonapi_parse!(*args)
|
||||
Adapter::JsonApi::Deserialization.parse!(*args)
|
||||
end
|
||||
# :nocov:
|
||||
end
|
||||
end
|
||||
|
||||
@ -38,6 +38,7 @@ module ActiveModelSerializers
|
||||
end
|
||||
|
||||
# The following methods are needed to be minimally implemented for ActiveModel::Errors
|
||||
# :nocov:
|
||||
def self.human_attribute_name(attr, _options = {})
|
||||
attr
|
||||
end
|
||||
@ -45,5 +46,6 @@ module ActiveModelSerializers
|
||||
def self.lookup_ancestors
|
||||
[self]
|
||||
end
|
||||
# :nocov:
|
||||
end
|
||||
end
|
||||
|
||||
@ -32,11 +32,13 @@ module ActiveModelSerializers
|
||||
end
|
||||
end
|
||||
|
||||
# :nocov:
|
||||
generators do |app|
|
||||
Rails::Generators.configure!(app.config.generators)
|
||||
Rails::Generators.hidden_namespaces.uniq!
|
||||
require 'generators/rails/resource_override'
|
||||
end
|
||||
# :nocov:
|
||||
|
||||
if Rails.env.test?
|
||||
ActionController::TestCase.send(:include, ActiveModelSerializers::Test::Schema)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user