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