Sha256: e9aaa6279105bd4b5c34b7d68fffcf0d726143d0f42a78e10391a37731aef649

Contents?: true

Size: 1.33 KB

Versions: 19

Compression:

Stored size: 1.33 KB

Contents

# frozen_string_literal: true
# typed: false

describe WorkOS do
  describe '.configure' do
    context 'with key and no timeout' do
      before do
        WorkOS.configure do |config|
          config.key = 'example_api_key'
        end
      end

      it 'sets the key and default timeout configuration' do
        expect(WorkOS.config.key).to eq('example_api_key')
        expect(WorkOS.config.timeout).to eq(60)
      end
    end

    context 'with key and timeout' do
      before do
        WorkOS.configure do |config|
          config.key = 'example_api_key'
          config.timeout = 120
        end
      end

      it 'sets the key and timeout configuration' do
        expect(WorkOS.config.key).to eq('example_api_key')
        expect(WorkOS.config.timeout).to eq(120)
      end
    end
  end
end

describe WorkOS::Configuration do
  describe '.key!' do
    context 'with key set' do
      before do
        WorkOS.config.key = 'example_api_key'
      end

      it 'returns the key' do
        expect(WorkOS.config.key!).to eq('example_api_key')
      end
    end

    context 'with key not set' do
      before do
        WorkOS.config.key = nil
      end

      it 'throws an error' do
        expect do
          WorkOS.config.key!
        end.to raise_error(
          '`WorkOS.config.key` not set',
        )
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
workos-4.1.0 spec/lib/workos/configuration_spec.rb
workos-4.0.0 spec/lib/workos/configuration_spec.rb
workos-3.1.0 spec/lib/workos/configuration_spec.rb
workos-3.0.0 spec/lib/workos/configuration_spec.rb
workos-2.17.0 spec/lib/workos/configuration_spec.rb
workos-2.16.0 spec/lib/workos/configuration_spec.rb
workos-2.15.0 spec/lib/workos/configuration_spec.rb
workos-2.14.0 spec/lib/workos/configuration_spec.rb
workos-2.13.0 spec/lib/workos/configuration_spec.rb
workos-2.12.1 spec/lib/workos/configuration_spec.rb
workos-2.12.0 spec/lib/workos/configuration_spec.rb
workos-2.11.0 spec/lib/workos/configuration_spec.rb
workos-2.10.0 spec/lib/workos/configuration_spec.rb
workos-2.9.0 spec/lib/workos/configuration_spec.rb
workos-2.8.0 spec/lib/workos/configuration_spec.rb
workos-2.7.0 spec/lib/workos/configuration_spec.rb
workos-2.6.0 spec/lib/workos/configuration_spec.rb
workos-2.5.1 spec/lib/workos/configuration_spec.rb
workos-2.5.0 spec/lib/workos/configuration_spec.rb