Sha256: d6d650a6a66b2580a5b6d8e46647886dc9ad494cc66100b4f7b841ff0a7521d8

Contents?: true

Size: 1019 Bytes

Versions: 1

Compression:

Stored size: 1019 Bytes

Contents

require 'test_helper'

module ActiveModel
  class SerializableResourceTest < ActiveSupport::TestCase
    def setup
      @resource = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
      @serializer = ProfileSerializer.new(@resource)
      @adapter = ActiveModel::Serializer::Adapter.create(@serializer)
      @serializable_resource = ActiveModel::SerializableResource.new(@resource)
    end

    def test_serializable_resource_delegates_serializable_hash_to_the_adapter
      options = nil
      assert_equal @adapter.serializable_hash(options), @serializable_resource.serializable_hash(options)
    end

    def test_serializable_resource_delegates_to_json_to_the_adapter
      options = nil
      assert_equal @adapter.to_json(options), @serializable_resource.to_json(options)
    end

    def test_serializable_resource_delegates_as_json_to_the_adapter
      options = nil
      assert_equal @adapter.as_json(options), @serializable_resource.as_json(options)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_model_serializers-0.10.0.rc4 test/serializable_resource_test.rb