Sha256: 26797bcd55fe7bf231666814aaf5efb236b98e44ddc3dc9a44d12f68ae2c5094
Contents?: true
Size: 1.28 KB
Versions: 4
Compression:
Stored size: 1.28 KB
Contents
# frozen_string_literal: true require_relative '../shared_contexts/with_document' describe Onfido::Document do describe 'Documents' do include_context 'with document' it 'uploads a document' do expect(document).not_to be_nil expect(document.id).not_to be_empty expect(document.file_name).to eq('sample_driving_licence.png') expect(document).to be_an_instance_of(Onfido::Document) end it 'lists documents' do list_of_documents = onfido_api.list_documents(applicant_id) expect(list_of_documents).to be_an_instance_of(Onfido::DocumentsList) expect(list_of_documents.documents.size).to be > 0 end it 'finds a document' do get_document = onfido_api.find_document(document_id) expect(get_document).to be_an_instance_of(Onfido::Document) expect(get_document.id).to eq document_id end it 'downloads a document' do file = onfido_api.download_document(document_id) expect(file.size).to be > 0 end it 'cannot download an inexistent document' do inexistent_document_id = '00000000-0000-0000-0000-000000000000' expect { onfido_api.download_document(inexistent_document_id) }.to raise_error(Onfido::ApiError) { |e| expect(e.code).to eq(404) } end end end
Version data entries
4 entries across 4 versions & 1 rubygems