Sha256: 5a6d428d0f924c36a1bec38a8dd2b9c47564fae03375bf1034dbbf0f5555cce2

Contents?: true

Size: 975 Bytes

Versions: 2

Compression:

Stored size: 975 Bytes

Contents

require_relative '../test_helper'
require 'hyperclient'

module Hyperclient
  describe Curie do
    let(:entry_point) do
      EntryPoint.new('http://api.example.org/')
    end

    describe 'templated?' do
      it 'returns true if the curie is templated' do
        curie = Curie.new({ 'name' => 'image', 'templated' => true }, entry_point)

        _(curie.templated?).must_equal true
      end

      it 'returns false if the curie is not templated' do
        curie = Curie.new({ 'name' => 'image' }, entry_point)

        _(curie.templated?).must_equal false
      end
    end

    let(:curie) do
      Curie.new({ 'name' => 'image', 'href' => '/images/{rel}', 'templated' => true }, entry_point)
    end
    describe '_name' do
      it 'returns curie name' do
        _(curie.name).must_equal 'image'
      end
    end
    describe 'expand' do
      it 'expands link' do
        _(curie.expand('thumbnail')).must_equal '/images/thumbnail'
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hyperclient-2.0.0 test/hyperclient/curie_test.rb
hyperclient-1.0.1 test/hyperclient/curie_test.rb