Sha256: 1a0c1c19930f49f79c757d5bb88a80350034af95af0c03cc90db773250cfab76

Contents?: true

Size: 540 Bytes

Versions: 4

Compression:

Stored size: 540 Bytes

Contents

require 'test_helper'

module ActiveModel
  class Serializer
    class RootTest < ActiveSupport::TestCase
      def setup
        @virtual_value = VirtualValue.new(id: 1)
      end

      def test_overwrite_root
        serializer = VirtualValueSerializer.new(@virtual_value, { root: 'smth' })
        assert_equal('smth', serializer.json_key)
      end

      def test_underscore_in_root
        serializer = VirtualValueSerializer.new(@virtual_value)
        assert_equal('virtual_value', serializer.json_key)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
active_model_serializers-0.10.1 test/serializers/root_test.rb
active_model_serializers-0.10.0 test/serializers/root_test.rb
active_model_serializers-0.10.0.rc5 test/serializers/root_test.rb
active_model_serializers-0.10.0.rc4 test/serializers/root_test.rb