Sha256: 8b421d64d0518ed4e4969d70f72a8c11e4531cde3e05812d11a6718a1b9d018c

Contents?: true

Size: 699 Bytes

Versions: 2

Compression:

Stored size: 699 Bytes

Contents

require 'spec_helper'

describe 'Braintree::ClientToken.generate' do
  it 'includes expected encoded fields' do
    raw_client_token = Braintree::ClientToken.generate
    client_token = decode_client_token(raw_client_token)

    regex = /\Ahttp:\/\/localhost:\d+\/merchants\/[^\/]+\/client_api\Z/
    expect(client_token['clientApiUrl']).to match regex
    expect(client_token['authUrl']).to eq 'http://auth.venmo.dev:9292'
    regex = /\Ahttp:\/\/localhost:\d+\/config\Z/
    expect(client_token['configUrl']).to match regex
  end

  def decode_client_token(raw_client_token)
    decoded_client_token_string = Base64.decode64(raw_client_token)
    JSON.parse(decoded_client_token_string)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fake_braintree-0.8.0 spec/fake_braintree/client_token_spec.rb
fake_braintree-0.7.0 spec/fake_braintree/client_token_spec.rb