Improve Coverage

This commit is contained in:
Benjamin Fleischer 2016-06-07 01:50:03 -05:00
parent 35a7c81034
commit 253205bb49
8 changed files with 10 additions and 9 deletions

View File

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

View File

@ -2,9 +2,6 @@ module ActiveModel
class Serializer
# @api private
class BelongsToReflection < SingularReflection
def macro
:belongs_to
end
end
end
end

View File

@ -2,9 +2,6 @@ module ActiveModel
class Serializer
# @api private
class HasManyReflection < CollectionReflection
def macro
:has_many
end
end
end
end

View File

@ -2,9 +2,6 @@ module ActiveModel
class Serializer
# @api private
class HasOneReflection < SingularReflection
def macro
:has_one
end
end
end
end

View File

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

View File

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

View File

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

View File

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