Sha256: 35ce2ab7d1e2805e8d3c84253da6dbbb16c2acdc4967654b5eaca23894fad40a

Contents?: true

Size: 1.38 KB

Versions: 6

Compression:

Stored size: 1.38 KB

Contents

require 'dock_health_api'
require 'spec_helper'

RSpec.describe DockHealthApi::Client do
  let(:config) { DockHealthApi::Config.new }

  it 'should be able to be initialized with a Config object' do
    client = DockHealthApi::Client.new(config)
    expect(client.config).to eq(config)
  end

  describe '#active_client' do
    it 'should config new client with standard config' do
      expect(DockHealthApi::Client.active_client.config).to eq(DockHealthApi.config)
    end
  end

  describe "#connection" do
    it 'should initialize an OAuth2::Client object' do
      expect(DockHealthApi::Client.active_client.connection.is_a?(OAuth2::Client))
    end
  end

  describe "#token_connection" do
    let (:token_connection) { DockHealthApi::Client.active_client.token_connection }

    it 'should return a OAuth2::AccessToken object' do
      expect(token_connection.is_a?(OAuth2::AccessToken))
    end

    it 'should return include a token' do
      expect(token_connection.token).to_not be(nil)
    end
  end

  describe "#get_iframe_token" do
    let (:iframe_token_connection) { DockHealthApi::Client.active_client.iframe_token_connection }

    it 'should return a OAuth2::AccessToken object for iframe' do
      expect(iframe_token_connection.is_a?(OAuth2::AccessToken))
    end

    it 'should return include an iframe token' do
      expect(iframe_token_connection.token).to_not be(nil)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dock_health_api-0.5.5 spec/client_spec.rb
dock_health_api-0.5.4 spec/client_spec.rb
dock_health_api-0.5.3 spec/client_spec.rb
dock_health_api-0.5.1 spec/client_spec.rb
dock_health_api-0.4.1 spec/client_spec.rb
dock_health_api-0.4.0 spec/client_spec.rb