Sha256: 53efb7577b9cc0c9acbe9189efcfa3b5e5b8d35604b2fefd950f6c5c56bd6964

Contents?: true

Size: 855 Bytes

Versions: 17

Compression:

Stored size: 855 Bytes

Contents

describe Onfido::API do
  subject(:api) { described_class.new }

  describe 'given a single-word resource' do
    specify { expect(api.address).to be_a(Onfido::Address) }
  end

  describe 'given a multi-word resource' do
    specify { expect(api.live_photo).to be_a(Onfido::LivePhoto) }
  end

  describe 'given an unknown resource' do
    specify { expect { api.blood_test }.to raise_error(NameError) }
  end

  describe 'given no API key' do
    it 'uses nil for the resource API key' do
      expect(Onfido::Address).to receive(:new).with(nil)
      api.address
    end
  end

  describe 'given an API key' do
    let(:api_key) { 'some_key' }

    subject(:api) { described_class.new(api_key: api_key) }

    it 'uses that key to create the resource' do
      expect(Onfido::Address).to receive(:new).with(api_key)
      api.address
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
onfido-1.1.1 spec/onfido/api_spec.rb
onfido-0.15.1 spec/onfido/api_spec.rb
onfido-1.1.0 spec/onfido/api_spec.rb
onfido-1.0.0 spec/onfido/api_spec.rb
onfido-0.15.0 spec/onfido/api_spec.rb
onfido-0.14.0 spec/onfido/api_spec.rb
onfido-0.13.0 spec/onfido/api_spec.rb
onfido-0.12.0 spec/onfido/api_spec.rb
onfido-0.11.0 spec/onfido/api_spec.rb
onfido-0.10.0 spec/onfido/api_spec.rb
onfido-0.9.0 spec/onfido/api_spec.rb
onfido-0.8.4 spec/onfido/api_spec.rb
onfido-0.8.3 spec/onfido/api_spec.rb
onfido-0.8.2 spec/onfido/api_spec.rb
onfido-0.8.1 spec/onfido/api_spec.rb
onfido-0.7.1 spec/onfido/api_spec.rb
onfido-0.7.0 spec/onfido/api_spec.rb