Sha256: 550602734e7862fde4a439c8bafdd7a8fc8dcca377cf11e3b784458a2a396406

Contents?: true

Size: 1.59 KB

Versions: 10

Compression:

Stored size: 1.59 KB

Contents

# frozen_string_literal: true

require_relative '../shared_contexts/with_onfido'

describe Onfido::MotionCapture do
  describe 'Motion Capture' do
    include_context 'with onfido'

    let(:applicant_id) { ENV['ONFIDO_SAMPLE_APPLICANT_ID'] }
    let(:motion_id) { ENV['ONFIDO_SAMPLE_MOTION_ID_1'] }

    it 'lists motion captures' do
      motion_captures = onfido_api.list_motion_captures(applicant_id)

      expect(motion_captures.motion_captures.length).to be > 0
      expect(motion_captures).to be_an_instance_of Onfido::MotionCapturesList
      expect(motion_captures.motion_captures.first).to be_an_instance_of Onfido::MotionCapture
    end

    it 'retrieves motion capture' do
      get_motion_capture = onfido_api.find_motion_capture(motion_id)

      expect(get_motion_capture.id).to eq(motion_id)
      expect(get_motion_capture).to be_an_instance_of Onfido::MotionCapture
    end

    it 'downloads motion capture' do
      file = onfido_api.download_motion_capture(motion_id)

      expect(file.length).to be > 0
    end

    it 'downloads motion capture frame' do
      file = onfido_api.download_motion_capture_frame(motion_id)

      expect(file.length).to be > 0
    end

    it 'raises an error with the correct status code when trying to download an inexistent motion capture' do
      inexistent_motion_id = '00000000-0000-0000-0000-000000000000'

      expect {
        onfido_api.download_motion_capture(inexistent_motion_id)
      }.to raise_error(Onfido::ApiError) { |e|
        expect(e.message).to match(/the server returns an error/)
        expect(e.code).to eq(404)
      }
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
onfido-4.3.0 spec/integrations/motion_capture_spec.rb
onfido-4.2.0 spec/integrations/motion_capture_spec.rb
onfido-4.1.0 spec/integrations/motion_capture_spec.rb
onfido-4.0.0 spec/integrations/motion_capture_spec.rb
onfido-3.4.0 spec/integrations/motion_capture_spec.rb
onfido-3.3.1 spec/integrations/motion_capture_spec.rb
onfido-3.3.0 spec/integrations/motion_capture_spec.rb
onfido-3.2.0 spec/integrations/motion_capture_spec.rb
onfido-3.1.0 spec/integrations/motion_capture_spec.rb
onfido-3.0.0 spec/integrations/motion_capture_spec.rb