spec/elasticsearch/transport/client_spec.rb in elasticsearch-transport-7.17.9 vs spec/elasticsearch/transport/client_spec.rb in elasticsearch-transport-7.17.10
- old
+ new
@@ -232,12 +232,12 @@
let(:adapter) { client.transport.connections.all.first.connection.builder.adapter }
it 'uses Faraday NetHttp' do
expect(adapter).to eq Faraday::Adapter::NetHttp
end
- end unless jruby?
- end
+ end
+ end unless jruby?
context 'when the adapter is patron' do
let(:adapter) do
client.transport.connections.all.first.connection.builder.adapter
end
@@ -245,20 +245,23 @@
let(:client) do
described_class.new(adapter: :patron, enable_meta_header: false)
end
it 'uses Faraday with the adapter' do
+ require 'faraday/patron'
expect(adapter).to eq Faraday::Adapter::Patron
end
- end
+ end unless jruby?
context 'when the adapter is typhoeus' do
let(:adapter) do
client.transport.connections.all.first.connection.builder.adapter
end
let(:client) do
+ require 'faraday/typhoeus' if is_faraday_v2?
+
described_class.new(adapter: :typhoeus, enable_meta_header: false)
end
it 'uses Faraday with the adapter' do
expect(adapter).to eq Faraday::Adapter::Typhoeus
@@ -275,11 +278,11 @@
end
it 'uses Faraday with the adapter' do
expect(adapter).to eq Faraday::Adapter::Patron
end
- end
+ end unless jruby?
context 'when the adapter can be detected', unless: jruby? do
around do |example|
require 'patron'; load 'patron.rb'
@@ -317,11 +320,11 @@
end
it 'sets the logger' do
expect(handlers).to include(Faraday::Response::Logger)
end
- end
+ end unless jruby?
end
context 'when cloud credentials are provided' do
let(:client) do
@@ -1585,10 +1588,12 @@
expect(response.body).to match(/---\n/)
expect(response.headers['content-type']).to eq('application/yaml')
end
context 'when the Faraday adapter is set in the block' do
+ require 'faraday/net_http_persistent' if is_faraday_v2?
+
let(:client) do
described_class.new(host: ELASTICSEARCH_HOSTS.first, logger: logger) do |client|
client.adapter(:net_http_persistent)
end
end
@@ -1745,9 +1750,10 @@
expect(client.transport.connections[0].connection.headers['User-Agent'])
end
end
context 'when using the HTTPClient adapter' do
+ require 'faraday/httpclient'
let(:client) do
described_class.new(hosts: ELASTICSEARCH_HOSTS, compression: true, adapter: :httpclient, enable_meta_header: false)
end