Sha256: 35644e3f2d08f490624fa1d1377e5f6fe9d91f9deedc2346f6ed69de17b96203

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

describe Itrp do
  it "should define a default configuration" do
    conf = Itrp.configuration.current

    expect(conf.keys.sort).to eq([:account, :api_token, :api_version, :block_at_rate_limit, :ca_file, :host, :logger, :max_retry_time, :proxy_host, :proxy_password, :proxy_port, :proxy_user, :read_timeout, :source])

    expect(conf[:logger].class).to eq(::Logger)
    expect(conf[:host]).to eq('https://api.itrp.com')
    expect(conf[:api_version]).to eq('v1')

    expect(conf[:max_retry_time]).to eq(5400)
    expect(conf[:read_timeout]).to eq(25)
    expect(conf[:block_at_rate_limit]).to be_falsey

    expect(conf[:proxy_port]).to eq(8080)

    [:api_token, :account, :source, :proxy_host, :proxy_user, :proxy_password].each do |no_default|
      expect(conf[no_default]).to be_nil
    end

    expect(conf[:ca_file]).to eq('../ca-bundle.crt')
  end

  it "should define a logger" do
    expect(Itrp.logger.class).to eq(::Logger)
  end

  it "should define an exception class" do
    expect { raise ::Itrp::Exception.new('test') }.to raise_error('test')
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
itrp-client-1.1.5 spec/lib/itrp_spec.rb
itrp-client-1.1.4 spec/lib/itrp_spec.rb
itrp-client-1.1.2 spec/lib/itrp_spec.rb
itrp-client-1.1.1 spec/lib/itrp_spec.rb
itrp-client-1.1.0 spec/lib/itrp_spec.rb