Sha256: fef345d702443c25e8776915258a12f7a19cff4dc581ed59d661437f4b291572

Contents?: true

Size: 958 Bytes

Versions: 25

Compression:

Stored size: 958 Bytes

Contents

require 'spec_helper'

module Intercom
  describe Client do
    let(:app_id) { 'myappid' }
    let(:api_key) { 'myapikey' }
    let(:client) { Client.new(app_id: app_id, api_key: api_key) }

    it 'should set the base url' do
      client.base_url.must_equal('https://api.intercom.io')
    end

    it 'should be able to change the base url' do
      prev = client.options(Intercom::Client.set_base_url('https://mymockintercom.io'))
      client.base_url.must_equal('https://mymockintercom.io')
      client.options(prev)
      client.base_url.must_equal('https://api.intercom.io')
    end

    it 'should raise on nil credentials' do
      proc { Client.new(app_id: nil, api_key: nil) }.must_raise MisconfiguredClientError
    end

    describe 'OAuth clients' do
      it 'supports "token"' do
        client = Client.new(token: 'foo')
        client.username_part.must_equal('foo')
        client.password_part.must_equal('')
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
intercom-3.5.26 spec/unit/intercom/client_spec.rb
intercom-3.5.25 spec/unit/intercom/client_spec.rb
intercom-3.5.24 spec/unit/intercom/client_spec.rb
intercom-3.5.23 spec/unit/intercom/client_spec.rb
intercom-3.5.22 spec/unit/intercom/client_spec.rb
intercom-3.5.21 spec/unit/intercom/client_spec.rb
intercom-3.5.20 spec/unit/intercom/client_spec.rb
intercom-3.5.19 spec/unit/intercom/client_spec.rb
intercom-3.5.17 spec/unit/intercom/client_spec.rb
intercom-3.5.16 spec/unit/intercom/client_spec.rb
intercom-3.5.15 spec/unit/intercom/client_spec.rb
intercom-3.5.14 spec/unit/intercom/client_spec.rb
intercom-3.5.12 spec/unit/intercom/client_spec.rb
intercom-3.5.11 spec/unit/intercom/client_spec.rb
intercom-3.5.10 spec/unit/intercom/client_spec.rb
intercom-3.5.9 spec/unit/intercom/client_spec.rb
intercom-3.5.8 spec/unit/intercom/client_spec.rb
intercom-3.5.7 spec/unit/intercom/client_spec.rb
intercom-3.5.6 spec/unit/intercom/client_spec.rb
intercom-3.5.5 spec/unit/intercom/client_spec.rb