Skip to content

Commit

Permalink
Add schedule to CI, fix and improve tests after library refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
dvacca-onfido committed Oct 21, 2024
1 parent ca06f97 commit a0e7a5a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ on:
release:
types:
- published
schedule:
- cron: "0 16 * * 0" # Every Sunday, 4 hours after midday

jobs:
integration-tests:
Expand Down
6 changes: 5 additions & 1 deletion spec/integrations/applicant_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
'location' => {
'ip_address' => '127.0.0.1',
'country_of_residence' => 'GBR'
}
},
'consents' => [{
'name' => Onfido::ApplicantConsentName::PRIVACY_NOTICES_READ,
'granted' => true
}]
}

applicant = onfido_api.create_applicant(params)
Expand Down
2 changes: 1 addition & 1 deletion spec/integrations/document_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

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|
Expand Down
2 changes: 1 addition & 1 deletion spec/integrations/qualified_electronic_signature_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
let!(:workflow_run_id) { workflow_run.id }

let(:file_id) do
task = onfido_api.list_tasks(workflow_run_id)[0]
task = onfido_api.list_tasks(workflow_run_id)[1]

output = repeat_request_until_task_output_changes(
max_retries = 10,
Expand Down
2 changes: 1 addition & 1 deletion spec/shared_contexts/with_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
let(:document_file_name) { 'sample_driving_licence.png' }
let(:document_file) { File.open("spec/integrations/media/#{document_file_name}") }

let(:document) { onfido_api.upload_document('passport', applicant_id, document_file) }
let(:document) { onfido_api.upload_document(Onfido::DocumentTypes::PASSPORT, applicant_id, document_file) }
let!(:document_id) { document.id }
end
8 changes: 4 additions & 4 deletions spec/webhook_event_verifier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
it "returns the decoded event payload" do
expected_payload = JSON.parse(event_body)["payload"]
expected_webhook_event = Onfido::WebhookEvent.new({ payload: Onfido::WebhookEventPayload.build_from_hash(expected_payload) })

webhook_event = subject.read_payload(event_body, sig)
expect(webhook_event.payload).to eq(expected_webhook_event.payload)
expect(webhook_event.payload.resource_type).to eq('check')
expect(webhook_event.payload.action).to eq('check.completed')
expect(webhook_event.payload.resource_type).to eq(Onfido::WebhookEventResourceType::CHECK)
expect(webhook_event.payload.action).to eq(Onfido::WebhookEventType::CHECK_COMPLETED)
expect(webhook_event.payload.object.id).to eq('f2302f45-227d-413d-ad61-09ec077a086a')
expect(webhook_event.payload.object.status).to eq('complete')
expect(webhook_event.payload.object.status).to eq(Onfido::WebhookEventObjectStatus::COMPLETE)
expect(webhook_event.payload.object.completed_at_iso8601).to eq(Time.parse('2024-04-04T09:21:21Z'))
expect(webhook_event.payload.object.href).to eq('https://api.onfido.com/v3.6/checks/f2302f45-227d-413d-ad61-09ec077a086a')
end
Expand Down

0 comments on commit a0e7a5a

Please sign in to comment.