spec/integrations/sdk_token_spec.rb in onfido-2.9.0 vs spec/integrations/sdk_token_spec.rb in onfido-3.0.0

- old
+ new

@@ -1,18 +1,20 @@ # frozen_string_literal: true +require_relative '../shared_contexts/with_applicant' + describe Onfido::SdkToken do - include_context 'fake onfido api' + describe 'SDK token' do + include_context 'with applicant' - subject(:sdk_token) { onfido.sdk_token } + it 'generates a SDK token' do + token_builder = Onfido::SdkTokenBuilder.new({ + applicant_id: applicant_id, + referrer: 'https://*.example.com/example_page/*', + }) + token = onfido_api.generate_sdk_token(token_builder) - describe '#create' do - it 'creates a new SDK token for the applicant' do - applicant_id = '61f659cb-c90b-4067-808a-6136b5c01351' - referrer = 'http://*.mywebsite.com/*' - - response = sdk_token.create(applicant_id: applicant_id, referrer: referrer) - - expect(response['token']).not_to be_nil + expect(token).to be_an_instance_of Onfido::SdkToken + expect(token.token.size).to be > 0 end end end