Sha256: 1e473f480fed23e7c94fcc231d933afafbc6c950ffd0d004fb74411c0121c58c

Contents?: true

Size: 1.41 KB

Versions: 10

Compression:

Stored size: 1.41 KB

Contents

# frozen_string_literal: true

require_relative '../shared_contexts/with_live_photo'

describe Onfido::LivePhoto do
  describe 'Live Photo' do
    include_context 'with live photo'

    it 'uploads a live photo' do
      expect(live_photo).not_to be_nil
      expect(live_photo_id).not_to be_empty
      expect(live_photo.file_name).to eq('sample_photo.png')
      expect(live_photo).to be_an_instance_of Onfido::LivePhoto
    end

    it 'lists live photos' do
      live_photos = onfido_api.list_live_photos(applicant_id)

      expect(live_photos.live_photos.length).to be > 0
      expect(live_photos).to be_an_instance_of Onfido::LivePhotosList
    end

    it 'retrieves live photo' do
      live_photo = onfido_api.find_live_photo(live_photo_id)

      expect(live_photo_id).to eq(live_photo_id)
      expect(live_photo).to be_an_instance_of Onfido::LivePhoto
    end

    it 'downloads live photo' do
      file = onfido_api.download_live_photo(live_photo_id)

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

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

      expect {
        onfido_api.download_live_photo(inexistent_live_photo_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_photo_spec.rb
onfido-4.2.0 spec/integrations/live_photo_spec.rb
onfido-4.1.0 spec/integrations/live_photo_spec.rb
onfido-4.0.0 spec/integrations/live_photo_spec.rb
onfido-3.4.0 spec/integrations/live_photo_spec.rb
onfido-3.3.1 spec/integrations/live_photo_spec.rb
onfido-3.3.0 spec/integrations/live_photo_spec.rb
onfido-3.2.0 spec/integrations/live_photo_spec.rb
onfido-3.1.0 spec/integrations/live_photo_spec.rb
onfido-3.0.0 spec/integrations/live_photo_spec.rb