Sha256: 87fb9cf7ed14ae22f2f081482ae2e0b8d245cd00d966badd5cf35029b7b2128f

Contents?: true

Size: 795 Bytes

Versions: 13

Compression:

Stored size: 795 Bytes

Contents

require 'test_helper'

module ActiveModel
  class Serializer
    class KeyFormatTest < Minitest::Test
      def test_lower_camel_format_option
        object     = WebLog.new({ name: 'Name 1', display_name: 'Display Name 1'})
        serializer = WebLogSerializer.new(object, key_format: :lower_camel)

        expected = { name: 'Name 1', displayName: 'Display Name 1' }

        assert_equal expected, serializer.serializable_object
      end

      def test_lower_camel_format_serializer
        object     = WebLog.new({ name: 'Name 1', display_name: 'Display Name 1'})
        serializer = WebLogLowerCamelSerializer.new(object)

        expected = { name: 'Name 1', displayName: 'Display Name 1' }

        assert_equal expected, serializer.serializable_object
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
active_model_serializers-0.9.13 test/unit/active_model/serializer/key_format_test.rb
active_model_serializers-0.9.12 test/unit/active_model/serializer/key_format_test.rb
active_model_serializers-0.9.11 test/unit/active_model/serializer/key_format_test.rb
active_model_serializers-0.9.9 test/unit/active_model/serializer/key_format_test.rb
active_model_serializers-0.9.8 test/unit/active_model/serializer/key_format_test.rb
active_model_serializers-0.9.7 test/unit/active_model/serializer/key_format_test.rb
active_model_serializers-0.9.6 test/unit/active_model/serializer/key_format_test.rb
active_model_serializers-0.9.5 test/unit/active_model/serializer/key_format_test.rb
active_model_serializers-0.9.4 test/unit/active_model/serializer/key_format_test.rb
active_model_serializers-0.9.3 test/unit/active_model/serializer/key_format_test.rb
active_model_serializers-0.9.2 test/unit/active_model/serializer/key_format_test.rb
active_model_serializers-0.9.1 test/unit/active_model/serializer/key_format_test.rb
active_model_serializers-0.9.0 test/unit/active_model/serializer/key_format_test.rb