Sha256: 0867d7b89c3bd86a92d7dcbb718ce2e512a91d4ea97167b094db7ebc84ba785e

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

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

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

    describe 'connection' do
      it 'creates a Faraday connection with the entry point url' do
        entry_point.connection.url_prefix.to_s.must_equal 'http://my.api.org/'
      end

      it 'creates a Faraday connection with the default headers' do
        entry_point.headers['Content-Type'].must_equal 'application/json'
        entry_point.headers['Accept'].must_equal 'application/json'
      end

      it 'creates a Faraday connection with the default block' do
        handlers = entry_point.connection.builder.handlers
        handlers.must_include FaradayMiddleware::EncodeJson
        handlers.must_include FaradayMiddleware::ParseJson
        handlers.must_include Faraday::Adapter::NetHttp
      end
    end

    describe 'initialize' do
      it 'sets a Link with the entry point url' do
        entry_point.url.must_equal 'http://my.api.org'
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hyperclient-0.4.0 test/hyperclient/entry_point_test.rb
hyperclient-0.3.2 test/hyperclient/entry_point_test.rb
hyperclient-0.3.1 test/hyperclient/entry_point_test.rb
hyperclient-0.3.0 test/hyperclient/entry_point_test.rb