Sha256: f84c2fec6e2c83e1123ab2cd3ccdea04595103f92706258c416b1cdc467b244f

Contents?: true

Size: 1010 Bytes

Versions: 12

Compression:

Stored size: 1010 Bytes

Contents

require 'test_helper'

module ActiveModel
  class SerializableResourceTest < Minitest::Test
    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

12 entries across 12 versions & 2 rubygems

Version Path
active_model_serializers-0.10.0.rc3 test/serializable_resource_test.rb
cheap_ams-0.10.11 test/serializable_resource_test.rb
cheap_ams-0.10.10 test/serializable_resource_test.rb
cheap_ams-0.10.8 test/serializable_resource_test.rb
cheap_ams-0.10.7 test/serializable_resource_test.rb
cheap_ams-0.10.6 test/serializable_resource_test.rb
cheap_ams-0.10.5 test/serializable_resource_test.rb
cheap_ams-0.10.4 test/serializable_resource_test.rb
cheap_ams-0.10.3 test/serializable_resource_test.rb
cheap_ams-0.10.2 test/serializable_resource_test.rb
cheap_ams-0.10.1 test/serializable_resource_test.rb
cheap_ams-0.10.0.rc2 test/serializable_resource_test.rb