Sha256: 3cbd8547adb04e533b2fcd8f08a1c9c1123c3162867f0e459db0c139431f5d65

Contents?: true

Size: 1.07 KB

Versions: 8

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

RSpec.describe Lokalise do
  specify '.client' do
    expect(test_client).to be_an_instance_of(Lokalise::Client)
    expect(test_client.token).to eq(ENV['LOKALISE_API_TOKEN'])
    expect(test_client.timeout).to be_nil
    expect(test_client.open_timeout).to be_nil
  end

  specify '.reset_client!' do
    expect(test_client).to be_an_instance_of(Lokalise::Client)
    described_class.reset_client!
    current_client = described_class.instance_variable_get '@client'
    expect(current_client).to be_nil
  end

  context 'with client params' do
    before { described_class.reset_client! }

    after { described_class.reset_client! }

    it 'is possible to customize timeout' do
      custom_client = described_class.client(ENV['LOKALISE_API_TOKEN'], timeout: 600)
      expect(custom_client.timeout).to eq(600)
    end

    it 'is possible to customize open timeout' do
      custom_client = described_class.client(ENV['LOKALISE_API_TOKEN'], open_timeout: 100)
      expect(custom_client.open_timeout).to eq(100)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ruby-lokalise-api-4.2.0 spec/lib/ruby-lokalise-api_spec.rb
ruby-lokalise-api-4.1.0 spec/lib/ruby-lokalise-api_spec.rb
ruby-lokalise-api-4.0.0 spec/lib/ruby-lokalise-api_spec.rb
ruby-lokalise-api-3.1.0 spec/lib/ruby-lokalise-api_spec.rb
ruby-lokalise-api-3.0.0 spec/lib/ruby-lokalise-api_spec.rb
ruby-lokalise-api-2.10.0 spec/lib/ruby-lokalise-api_spec.rb
ruby-lokalise-api-2.9.0.1 spec/lib/ruby-lokalise-api_spec.rb
ruby-lokalise-api-2.9.0 spec/lib/ruby-lokalise-api_spec.rb