Sha256: 91e687551d4f449d6ba26e24e82b09f0153642954ee7a121520e938f0d468bae

Contents?: true

Size: 856 Bytes

Versions: 2

Compression:

Stored size: 856 Bytes

Contents

require 'test_helper'
module ActiveModel
  class Serializer
    class Adapter
      class FragmentCacheTest < Minitest::Test
        def setup
          @author          = Author.new(name: 'Joao M. D. Moura')
          @role            = Role.new(name: 'Great Author', description:nil)
          @role.author     = [@author]
          @role_serializer = RoleSerializer.new(@role)
          @role_hash       = FragmentCache.new(RoleSerializer.adapter.new(@role_serializer), @role_serializer, {}, nil)
        end

        def test_fragment_fetch_with_virtual_attributes
          expected_result = {
            id: @role.id,
            description: @role.description,
            slug: "#{@role.name}-#{@role.id}",
            name: @role.name
          }
          assert_equal(@role_hash.fetch, expected_result)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
cm-active_model_serializers-0.10.0.rc1.1 test/adapter/fragment_cache_test.rb
active_model_serializers-0.10.0.rc1 test/adapter/fragment_cache_test.rb