Sha256: c1c799a25f1f056bc22a249d51e1c9e4d0e70e0a31548732b28fba7d521b9c7e

Contents?: true

Size: 1.59 KB

Versions: 3

Compression:

Stored size: 1.59 KB

Contents

# Configure Rails Environment
ENV['RAILS_ENV'] = 'test'
require 'bundler/setup'

begin
  require 'simplecov'
  AppCoverage.start
rescue LoadError
  STDERR.puts 'Running without SimpleCov'
end

require 'timecop'
require 'rails'
require 'action_controller'
require 'action_controller/test_case'
require 'action_controller/railtie'
require 'active_model_serializers'
# For now, we only restrict the options to serializable_hash/as_json/to_json
# in tests, to ensure developers don't add any unsupported options.
# There's no known benefit, at this time, to having the filtering run in
# production when the excluded options would simply not be used.
#
# However, for documentation purposes, the constant
# ActiveModel::Serializer::SERIALIZABLE_HASH_VALID_KEYS is defined
# in the Serializer.
ActiveModelSerializers::Adapter::Base.class_eval do
  alias_method :original_serialization_options, :serialization_options

  def serialization_options(options)
    original_serialization_options(options)
      .slice(*ActiveModel::Serializer::SERIALIZABLE_HASH_VALID_KEYS)
  end
end
require 'fileutils'
FileUtils.mkdir_p(File.expand_path('../../tmp/cache', __FILE__))

gem 'minitest'
require 'minitest'
require 'minitest/autorun'
Minitest.backtrace_filter = Minitest::BacktraceFilter.new

require 'support/rails_app'

# require "rails/test_help"

require 'support/serialization_testing'

require 'support/rails5_shims'

require 'fixtures/active_record'

require 'fixtures/poro'

ActiveSupport.on_load(:action_controller) do
  $action_controller_logger = ActiveModelSerializers.logger
  ActiveModelSerializers.logger = Logger.new(IO::NULL)
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
active_model_serializers-0.10.2 test/test_helper.rb
active_model_serializers-0.10.1 test/test_helper.rb
active_model_serializers-0.10.0 test/test_helper.rb