Skip to content

Commit cb3fad7

Browse files
Merge pull request #76 from DiogoAndreBotas/add-tests-for-download-nfc-face-endpoint
Add tests for Download NFC Face endpoint
2 parents 4e2bbbf + c89d283 commit cb3fad7

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

spec/integrations/document_spec.rb

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,25 @@
3434
end
3535

3636
it 'cannot download an inexistent document' do
37-
inexistent_document_id = '00000000-0000-0000-0000-000000000000'
38-
3937
expect {
4038
onfido_api.download_document(inexistent_document_id)
4139
}.to raise_error(Onfido::ApiError) { |e|
4240
expect(e.code).to eq(404)
4341
}
4442
end
43+
44+
it 'downloads an NFC face' do
45+
file = onfido_api.download_nfc_face(nfc_face_id)
46+
47+
expect(file.size).to be > 0
48+
end
49+
50+
it 'cannot download an inexistent NFC face' do
51+
expect {
52+
onfido_api.download_nfc_face(inexistent_document_id)
53+
}.to raise_error(Onfido::ApiError) { |e|
54+
expect(e.code).to eq(404)
55+
}
56+
end
4557
end
4658
end

spec/shared_contexts/with_document.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@
1010

1111
let(:document) { onfido_api.upload_document(Onfido::DocumentTypes::PASSPORT, applicant_id, document_file) }
1212
let!(:document_id) { document.id }
13+
14+
let(:nfc_face_id) { 'cc2dc25f-2df6-4f8f-a5aa-60f49cef9b3c' }
15+
16+
let(:inexistent_document_id) { '00000000-0000-0000-0000-000000000000' }
1317
end

0 commit comments

Comments
 (0)