spec/elasticsearch/transport/base_spec.rb in elasticsearch-transport-7.4.0 vs spec/elasticsearch/transport/base_spec.rb in elasticsearch-transport-7.5.0.pre.pre
- old
+ new
@@ -3,25 +3,23 @@
# See the LICENSE file in the project root for more information
require 'spec_helper'
describe Elasticsearch::Transport::Transport::Base do
-
context 'when a host is printed in a logged message' do
-
shared_examples_for 'a redacted string' do
-
let(:client) do
Elasticsearch::Transport::Client.new(arguments)
end
let(:logger) do
double('logger', error?: true, error: '')
end
it 'does not include the password in the logged string' do
expect(logger).not_to receive(:error).with(/secret_password/)
+
expect {
client.cluster.stats
}.to raise_exception(Faraday::ConnectionFailed)
end
@@ -32,11 +30,10 @@
}.to raise_exception(Faraday::ConnectionFailed)
end
end
context 'when the user and password are provided as separate arguments' do
-
let(:arguments) do
{ hosts: 'fake',
logger: logger,
password: 'secret_password',
user: 'test' }
@@ -44,22 +41,20 @@
it_behaves_like 'a redacted string'
end
context 'when the user and password are provided in the string URI' do
-
let(:arguments) do
- { hosts: 'http://test:secret_password@fake.com',
+ { hosts: 'https://test:secret_password@fake_local_elasticsearch',
logger: logger }
end
it_behaves_like 'a redacted string'
end
context 'when the user and password are provided in the URI object' do
-
let(:arguments) do
- { hosts: URI.parse('http://test:secret_password@fake.com'),
+ { hosts: URI.parse('https://test:secret_password@fake_local_elasticsearch'),
logger: logger }
end
it_behaves_like 'a redacted string'
end