Skip to content

Commit

Permalink
[rb] update to require minimum Ruby version 2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Apr 2, 2020
1 parent bc5dfbb commit 6f69895
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ _bindings:
if: env(BUILD_ONLY) IS NOT present || env(BUILD_ONLY) =~ /python/
ruby: &ruby
language: ruby
rvm: 2.4
rvm: 2.5
jdk: openjdk11
if: env(BUILD_ONLY) IS NOT present || env(BUILD_ONLY) =~ /ruby/
node: &node
Expand Down
2 changes: 1 addition & 1 deletion rb/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ require:
- rubocop-rspec

AllCops:
TargetRubyVersion: 2.4
TargetRubyVersion: 2.5

Layout/SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space
Expand Down
8 changes: 3 additions & 5 deletions rb/lib/selenium/webdriver/chrome/bridge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,9 @@ def log(type)
data = execute :get_log, {}, {type: type.to_s}

Array(data).map do |l|
begin
LogEntry.new l.fetch('level', 'UNKNOWN'), l.fetch('timestamp'), l.fetch('message')
rescue KeyError
next
end
LogEntry.new l.fetch('level', 'UNKNOWN'), l.fetch('timestamp'), l.fetch('message')
rescue KeyError
next
end
end
end # Bridge
Expand Down
10 changes: 4 additions & 6 deletions rb/lib/selenium/webdriver/common/port_prober.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ def self.above(port)

def self.free?(port)
Platform.interfaces.each do |host|
begin
TCPServer.new(host, port).close
rescue *IGNORED_ERRORS => e
WebDriver.logger.debug("port prober could not bind to #{host}:#{port} (#{e.message})")
# ignored - some machines appear unable to bind to some of their interfaces
end
TCPServer.new(host, port).close
rescue *IGNORED_ERRORS => e
WebDriver.logger.debug("port prober could not bind to #{host}:#{port} (#{e.message})")
# ignored - some machines appear unable to bind to some of their interfaces
end

true
Expand Down
2 changes: 1 addition & 1 deletion rb/selenium-webdriver.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Gem::Specification.new do |s|
}

s.required_rubygems_version = Gem::Requirement.new('> 1.3.1') if s.respond_to? :required_rubygems_version=
s.required_ruby_version = Gem::Requirement.new('>= 2.4')
s.required_ruby_version = Gem::Requirement.new('>= 2.5')

s.files = Dir[root + '/**/*'].reject { |e| e =~ /ruby\.iml|build\.desc/ }.map { |e| e.sub(root + '/', '') }
s.require_paths = ['lib']
Expand Down
14 changes: 6 additions & 8 deletions rb/spec/unit/selenium/webdriver/common/logger_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,12 @@ module WebDriver
end

it 'allows output to file' do
begin
logger.output = 'test.log'
logger.warn('message')
expect(File.read('test.log')).to include('WARN Selenium message')
ensure
logger.close
File.delete('test.log')
end
logger.output = 'test.log'
logger.warn('message')
expect(File.read('test.log')).to include('WARN Selenium message')
ensure
logger.close
File.delete('test.log')
end
end

Expand Down

0 comments on commit 6f69895

Please sign in to comment.