Sha256: 62189e36737bc9b80b3a0cb469ff714131ec9149a9c0192281c030d113c7d5d3

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

require 'test_helper'

module ActiveModel
  class Serializer
    class ConfigurationTest < ActiveSupport::TestCase
      def test_collection_serializer
        assert_equal ActiveModel::Serializer::CollectionSerializer, ActiveModelSerializers.config.collection_serializer
      end

      def test_array_serializer
        assert_equal ActiveModel::Serializer::CollectionSerializer, ActiveModelSerializers.config.array_serializer
      end

      def test_setting_array_serializer_sets_collection_serializer
        config = ActiveModelSerializers.config
        old_config = config.dup
        begin
          assert_equal ActiveModel::Serializer::CollectionSerializer, config.collection_serializer
          config.array_serializer = :foo
          assert_equal config.array_serializer, :foo
          assert_equal config.collection_serializer, :foo
        ensure
          ActiveModelSerializers.config.replace(old_config)
        end
      end

      def test_default_adapter
        assert_equal :attributes, ActiveModelSerializers.config.adapter
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
active_model_serializers_custom-0.10.90 test/serializers/configuration_test.rb
active_model_serializers-0.10.9 test/serializers/configuration_test.rb