Sha256: 441d9798e725a3f6903e5a1c6d2ccea5a072484de0ee319cacc0e3c0f31c6949

Contents?: true

Size: 963 Bytes

Versions: 8

Compression:

Stored size: 963 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

8 entries across 8 versions & 1 rubygems

Version Path
hyperclient-0.9.3 test/hyperclient/curie_test.rb
hyperclient-0.9.1 test/hyperclient/curie_test.rb
hyperclient-0.9.0 test/hyperclient/curie_test.rb
hyperclient-0.8.6 test/hyperclient/curie_test.rb
hyperclient-0.8.5 test/hyperclient/curie_test.rb
hyperclient-0.8.4 test/hyperclient/curie_test.rb
hyperclient-0.8.3 test/hyperclient/curie_test.rb
hyperclient-0.8.2 test/hyperclient/curie_test.rb