Skip to content

Commit 236f137

Browse files
committed
Addresses warnings
1 parent b2af946 commit 236f137

6 files changed

Lines changed: 15 additions & 9 deletions

File tree

elasticsearch-api/Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ group :development do
3232
else
3333
gem 'debug'
3434
end
35-
# Related to https://github.com/ruby-i18n/i18n/issues/735
36-
# Keeping here for compatiblity with JRuby 9.x
35+
# TODO: Related to https://github.com/ruby-i18n/i18n/issues/735
36+
# TODO: Keeping here for compatiblity with JRuby 9.x
3737
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.2') &&
3838
Gem::Version.new(RUBY_VERSION) > Gem::Version.new('2.6')
3939
gem 'i18n', '1.14'

elasticsearch-api/lib/elasticsearch/api.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
require 'cgi'
18+
require 'cgi/escape'
1919
require 'multi_json'
2020
require 'elasticsearch/api/version'
2121
require 'elasticsearch/api/utils'

elasticsearch-api/spec/integration/integration_helper.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121

2222
CERTS_PATH = File.expand_path('./../../../.buildkite/certs', __dir__)
2323
host = ENV['TEST_ES_SERVER'] || 'http://localhost:9200'
24-
raise URI::InvalidURIError unless host =~ /\A#{URI::DEFAULT_PARSER.make_regexp}\z/
24+
# TODO: For compatiblity with JRuby 9.3
25+
parser = defined?(URI::RFC2396_PARSER) ? URI::RFC2396_PARSER : URI::DEFAULT_PARSER
26+
raise URI::InvalidURIError unless host =~ /\A#{parser.make_regexp}\z/
2527

2628
password = ENV['ELASTIC_PASSWORD'] || 'changeme'
2729
HOST_URI = URI.parse(host)

elasticsearch/spec/integration/client_integration_spec.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717
ELASTICSEARCH_URL = ENV['TEST_ES_SERVER'] || "http://localhost:#{(ENV['PORT'] || 9200)}"
18-
raise URI::InvalidURIError unless ELASTICSEARCH_URL =~ /\A#{URI::DEFAULT_PARSER.make_regexp}\z/
18+
# TODO: For compatiblity with JRuby 9.3
19+
parser = defined?(URI::RFC2396_PARSER) ? URI::RFC2396_PARSER : URI::DEFAULT_PARSER
20+
raise URI::InvalidURIError unless ELASTICSEARCH_URL =~ /\A#{parser.make_regexp}\z/
1921

2022
require 'spec_helper'
2123
require 'logger'
@@ -49,7 +51,7 @@
4951
it 'Reports es service name and gem version' do
5052
headers = CLIENT.transport.connections.first.connection.headers
5153
version = Class.new.extend(Elastic::Transport::MetaHeader).send(:client_meta_version, Elasticsearch::VERSION)
52-
expect(headers['x-elastic-client-meta']).to match /^es=#{version}/
54+
expect(headers['x-elastic-client-meta']).to match(/^es=#{version}/)
5355
end
5456
end
5557
end

elasticsearch/spec/integration/helpers/bulk_helper_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
context 'JSON File helper' do
114114
let(:file) { Tempfile.new('test-data.json') }
115115
let(:json) do
116-
json = <<~JSON
116+
<<~JSON
117117
[
118118
{
119119
"character_name": "Anallese Lonie",
@@ -168,7 +168,7 @@
168168

169169
context 'with data not in root of JSON file' do
170170
let(:json) do
171-
json = <<~JSON
171+
<<~JSON
172172
{
173173
"field": "value",
174174
"status": 200,

elasticsearch/spec/spec_helper.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ def jruby?
4545

4646
CERTS_PATH = File.expand_path('../../.buildkite/certs', __dir__)
4747
host = ENV['TEST_ES_SERVER'] || 'http://localhost:9200'
48-
raise URI::InvalidURIError unless host =~ /\A#{URI::DEFAULT_PARSER.make_regexp}\z/
48+
# TODO: For compatiblity with JRuby 9.3
49+
parser = defined?(URI::RFC2396_PARSER) ? URI::RFC2396_PARSER : URI::DEFAULT_PARSER
50+
raise URI::InvalidURIError unless host =~ /\A#{parser.make_regexp}\z/
4951

5052
password = ENV['ELASTIC_PASSWORD'] || 'changeme'
5153
HOST_URI = URI.parse(host)

0 commit comments

Comments
 (0)