Sha256: a7166b32379950eeec4ceeea19fb9cdce89123ac9ae8977df4a0a6c5ad02dca7

Contents?: true

Size: 964 Bytes

Versions: 1

Compression:

Stored size: 964 Bytes

Contents

# frozen_string_literal: true

describe Onfido::Options do
  subject(:options) do
    described_class.new(
      api_key: 'test',
      region: :us,
      open_timeout: 1,
      read_timeout: 2
    )
  end

  it 'checks region is valid' do
    expect { described_class.new(api_key: 'test', region: :aa) }.to raise_error 'Unknown region aa'
  end

  context 'when creating rest client resource' do
    let(:rest_client) { options.rest_client }

    it 'configures with headers' do
      expect(rest_client.options[:headers]).to eq(
        'Accept' => 'application/json',
        'Authorization' => 'Token token=test',
        'User-Agent' => "onfido-ruby/#{Onfido::VERSION}"
      )
    end

    it 'configures with region' do
      expect(rest_client.url).to eq 'https://api.us.onfido.com/v3.4/'
    end

    it 'configures with timeouts' do
      expect(rest_client.options).to include(
        open_timeout: 1,
        read_timeout: 2
      )
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
onfido-2.3.0 spec/onfido/options_spec.rb