Sha256: 49629990ffc7d4b7be893e04784b84035b03dd766177e7e8423610d321dda157

Contents?: true

Size: 1.26 KB

Versions: 5

Compression:

Stored size: 1.26 KB

Contents

require 'spec_helper'

describe IEX::Api::Config::Client do
  before do
    IEX::Api.config.reset!
  end
  describe '#defaults' do
    it 'sets endpoint' do
      expect(IEX::Api.config.endpoint).to eq 'https://cloud.iexapis.com/v1'
    end
  end
  describe '#configure' do
    before do
      IEX::Api.configure do |config|
        config.endpoint = 'updated'
      end
    end
    it 'sets endpoint' do
      expect(IEX::Api.config.endpoint).to eq 'updated'
    end
  end

  context 'when configuring the logger' do
    after { IEX::Api.configure.logger.reset! }

    let(:logger) { Logger.new(STDOUT) }

    describe '#logger=' do
      it 'updates IEX::Api.config correctly' do
        expect do
          IEX::Api.configure { |config| config.logger = logger }
        end.to change(IEX::Api.config.logger, :instance).from(nil).to(logger)
      end

      it 'updates IEX::Api.logger correctly' do
        expect do
          IEX::Api.configure { |config| config.logger = logger }
        end.to change(IEX::Api.logger, :instance).from(nil).to(logger)
      end
    end

    describe '#logger' do
      it 'accesses the current logger' do
        expect { IEX::Api.logger = logger }
          .to change(IEX::Api.config.logger, :instance).from(nil).to(logger)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
iex-ruby-client-1.6.0 spec/iex/config/client_spec.rb
iex-ruby-client-1.5.0 spec/iex/config/client_spec.rb
iex-ruby-client-1.4.1 spec/iex/config/client_spec.rb
iex-ruby-client-1.4.0 spec/iex/config/client_spec.rb
iex-ruby-client-1.3.0 spec/iex/config/client_spec.rb