spec/app-search/client_spec.rb in elastic-enterprise-search-7.17.0 vs spec/app-search/client_spec.rb in elastic-enterprise-search-7.17.1
- old
+ new
@@ -83,6 +83,35 @@
decoded_token = JWT.decode(subject, key, true, algorithm: 'HS256')
expect(decoded_token[0]['api_key_name']).to(eq(api_key_name))
expect(decoded_token[0]['query']).to(eq('cat'))
end
end
+
+ context 'adapters' do
+ let(:client) { described_class.new }
+ let(:adapter) { client.transport.transport.connections.all.first.connection.builder.adapter }
+
+ context 'when no adapter is specified' do
+ it 'uses Faraday NetHttp' do
+ expect(adapter).to eq Faraday::Adapter::NetHttp
+ end
+ end
+
+ context 'when the adapter is patron' do
+ let(:client) { described_class.new(adapter: :patron) }
+
+ it 'uses Faraday with the adapter' do
+ expect(adapter).to eq Faraday::Adapter::Patron
+ end
+ end
+
+ unless defined?(JRUBY_VERSION)
+ context 'when the adapter is typhoeus' do
+ let(:client) { described_class.new(adapter: :patron) }
+
+ it 'uses Faraday with the adapter' do
+ expect(adapter).to eq Faraday::Adapter::Patron
+ end
+ end
+ end
+ end
end