Sha256: 0139499697140932a31d6e450d3c8dffcfb808aa15cdbdee38a477db78cdca3b
Contents?: true
Size: 1.52 KB
Versions: 1
Compression:
Stored size: 1.52 KB
Contents
require 'test_helper' require 'hyperclient' describe Hyperclient do describe 'new' do it 'creates a new EntryPoint with the url' do Hyperclient::EntryPoint.expects(:new).with('http://api.example.org') Hyperclient.new('http://api.example.org') end describe 'with an optional block' do let(:client) do Hyperclient.new('http://api.example.org') do |client| client.connection(default: true) do |conn| conn.use Faraday::Request::OAuth end client.headers['Access-Token'] = 'token' end end it 'creates a Faraday connection with the default and additional headers' do _(client.headers['Content-Type']).must_equal 'application/hal+json' _(client.headers['Accept']).must_equal 'application/hal+json,application/json' _(client.headers['Access-Token']).must_equal 'token' end it 'creates a Faraday connection with the entry point url' do _(client.connection.url_prefix.to_s).must_equal 'http://api.example.org/' end it 'creates a Faraday connection with the default block plus any additional handlers' do handlers = client.connection.builder.handlers _(handlers).must_include Faraday::Request::OAuth _(handlers).must_include Faraday::Response::RaiseError _(handlers).must_include FaradayMiddleware::FollowRedirects _(handlers).must_include FaradayMiddleware::EncodeHalJson _(handlers).must_include FaradayMiddleware::ParseHalJson end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hyperclient-1.0.1 | test/hyperclient_test.rb |