Sha256: d76b9d5b9de678c6fcce2854e32b86957860eb426d5190f83e82b3f670c18437

Contents?: true

Size: 614 Bytes

Versions: 2

Compression:

Stored size: 614 Bytes

Contents

require 'test_helper'

module ActiveModelSerializers
  class JsonPointerTest < ActiveSupport::TestCase
    def test_attribute_pointer
      attribute_name = 'title'
      pointer = ActiveModelSerializers::JsonPointer.new(:attribute, attribute_name)
      assert_equal '/data/attributes/title', pointer
    end

    def test_primary_data_pointer
      pointer = ActiveModelSerializers::JsonPointer.new(:primary_data)
      assert_equal '/data', pointer
    end

    def test_unkown_data_pointer
      assert_raises(TypeError) do
        ActiveModelSerializers::JsonPointer.new(:unknown)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_model_serializers-0.10.3 test/active_model_serializers/json_pointer_test.rb
active_model_serializers-0.10.2 test/active_model_serializers/json_pointer_test.rb