Sha256: 334bb602e65bb686d6bd7f5a3222bca2d7fb0cd776208daad878b69a491a1931

Contents?: true

Size: 1003 Bytes

Versions: 2

Compression:

Stored size: 1003 Bytes

Contents

require_relative '../test_helper'
require 'hyperclient/curie'
require 'hyperclient/entry_point'

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-0.8.1 test/hyperclient/curie_test.rb
hyperclient-0.8.0 test/hyperclient/curie_test.rb