Sha256: b7bb85ee8bf8990df4b5aea62a5c4e39e7c7f69e21afe8deca628934788535a4

Contents?: true

Size: 1.52 KB

Versions: 10

Compression:

Stored size: 1.52 KB

Contents

# frozen_string_literal: true

require_relative '../shared_contexts/with_onfido'

describe Onfido::LiveVideo do
  describe 'Live Video' do
    include_context 'with onfido'

    let(:applicant_id) { ENV['ONFIDO_SAMPLE_APPLICANT_ID'] }
    let(:live_video_id) { ENV['ONFIDO_SAMPLE_VIDEO_ID_1'] }

    it 'lists live videos' do
      live_videos = onfido_api.list_live_videos(applicant_id)

      expect(live_videos.live_videos.length).to be > 0
      expect(live_videos).to be_an_instance_of Onfido::LiveVideosList
      expect(live_videos.live_videos.first).to be_an_instance_of Onfido::LiveVideo
    end

    it 'retrieves live videos' do
      get_live_video = onfido_api.find_live_video(live_video_id)

      expect(get_live_video.id).to eq(live_video_id)
      expect(get_live_video).to be_an_instance_of Onfido::LiveVideo
    end

    it 'downloads live video' do
      file = onfido_api.download_live_video(live_video_id)

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

    it 'downloads live video frame' do
      file = onfido_api.download_live_video_frame(live_video_id)

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

    it 'raises an error with the correct status code when trying to download an inexistent live video' do
      inexistent_live_video_id = '00000000-0000-0000-0000-000000000000'

      expect {
        onfido_api.download_live_video(inexistent_live_video_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/live_video_spec.rb
onfido-4.2.0 spec/integrations/live_video_spec.rb
onfido-4.1.0 spec/integrations/live_video_spec.rb
onfido-4.0.0 spec/integrations/live_video_spec.rb
onfido-3.4.0 spec/integrations/live_video_spec.rb
onfido-3.3.1 spec/integrations/live_video_spec.rb
onfido-3.3.0 spec/integrations/live_video_spec.rb
onfido-3.2.0 spec/integrations/live_video_spec.rb
onfido-3.1.0 spec/integrations/live_video_spec.rb
onfido-3.0.0 spec/integrations/live_video_spec.rb