Sha256: c71c9259b3b2a421317d6ba732ea2946295a6ba027a81c017c01b2909a3ce901
Contents?: true
Size: 1.85 KB
Versions: 6
Compression:
Stored size: 1.85 KB
Contents
require 'spec_helper' describe Xcal::Parktronic::ApiClient do context 'initialization' do let(:api_http_client){ Xcal::Parktronic::ApiClient.new(endpoint: 'http://localhost:3000/v1', access_token: 'fake_access_token') } let(:api_http_proxy_client){ Xcal::Parktronic::ApiClient.new(endpoint: 'http://localhost:3000/v1', access_token: 'fake_access_token', proxy: 'http://localhost:3333') } let(:api_https_client){ Xcal::Parktronic::ApiClient.new(endpoint: 'https://localhost:3000/v1', access_token: 'fake_access_token') } let(:api_invalid_client){ Xcal::Parktronic::ApiClient.new(endpoint: 'http://', access_token: 'fake_access_token') } it 'should initialize correctly initialize' do api = Xcal::Parktronic::ApiClient.new(endpoint: 'http://localhost:3000/v1', access_token: 'access_token') expect(api.host).to eql('localhost') expect(api.access_token).to eql('access_token') api = Xcal::Parktronic::ApiClient.new('endpoint' => 'http://localhost:3000/v1', 'access_token' => 'access_token') expect(api.host).to eql('localhost') expect(api.access_token).to eql('access_token') end it 'should initialize correctly and provide access to arguments' do expect(api_http_client.host).to eql('localhost') expect(api_http_client.port).to eql(3000) expect(api_http_client.uri).to be_a_kind_of(URI) expect { api_invalid_client.http.get('/') } .to raise_error(URI::InvalidURIError, /bad URI/) end it 'should have a valid set of http arguments' do expect(api_http_client.http).to be_a_kind_of(Net::HTTP) # ssl expect(api_http_client.http.use_ssl?).to eql(false) expect(api_https_client.http.use_ssl?).to eql(true) # proxy expect([false, nil]).to include(api_http_client.http.proxy?) expect(api_http_proxy_client.http.proxy?).to eql(true) end end end
Version data entries
6 entries across 6 versions & 1 rubygems