Sha256: 8f5961f6cbc9506fee02e8a029dbd10cb753dccb003739f8d58747a5455c984c

Contents?: true

Size: 816 Bytes

Versions: 136

Compression:

Stored size: 816 Bytes

Contents

# frozen_string_literal: true

RSpec.describe Faraday::AdapterRegistry do
  describe '#initialize' do
    subject(:registry) { described_class.new }

    it { expect { registry.get(:FinFangFoom) }.to raise_error(NameError) }
    it { expect { registry.get('FinFangFoom') }.to raise_error(NameError) }

    it 'looks up class by string name' do
      expect(registry.get('Faraday::Connection')).to eq(Faraday::Connection)
    end

    it 'looks up class by symbol name' do
      expect(registry.get(:Faraday)).to eq(Faraday)
    end

    it 'caches lookups with implicit name' do
      registry.set :symbol
      expect(registry.get('symbol')).to eq(:symbol)
    end

    it 'caches lookups with explicit name' do
      registry.set 'string', :name
      expect(registry.get(:name)).to eq('string')
    end
  end
end

Version data entries

136 entries across 123 versions & 17 rubygems

Version Path
faraday-2.12.1 spec/faraday/adapter_registry_spec.rb
moneykit-0.1.15 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/spec/faraday/adapter_registry_spec.rb
moneykit-0.1.14 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/spec/faraday/adapter_registry_spec.rb
faraday-1.10.4 spec/faraday/adapter_registry_spec.rb
faraday-2.12.0 spec/faraday/adapter_registry_spec.rb
faraday-2.11.0 spec/faraday/adapter_registry_spec.rb
moneykit-0.1.13 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/spec/faraday/adapter_registry_spec.rb
moneykit-0.1.12 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/spec/faraday/adapter_registry_spec.rb
moneykit-0.1.11 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/spec/faraday/adapter_registry_spec.rb
faraday-2.10.1 spec/faraday/adapter_registry_spec.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/faraday-1.2.0/spec/faraday/adapter_registry_spec.rb
faraday-2.10.0 spec/faraday/adapter_registry_spec.rb
faraday-2.9.2 spec/faraday/adapter_registry_spec.rb
faraday-2.9.1 spec/faraday/adapter_registry_spec.rb
moneykit-0.1.10 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/spec/faraday/adapter_registry_spec.rb
moneykit-0.1.9 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/spec/faraday/adapter_registry_spec.rb
avalara_sdk-24.2.29 vendor/bundle/ruby/2.7.0/gems/faraday-1.10.3/spec/faraday/adapter_registry_spec.rb
moneykit-0.1.6 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/spec/faraday/adapter_registry_spec.rb
moneykit-0.1.5 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/spec/faraday/adapter_registry_spec.rb
moneykit-0.1.4 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.12/spec/faraday/adapter_registry_spec.rb