Skip to content

Commit a870613

Browse files
committed
rb - update string literals
1 parent cccc9fe commit a870613

File tree

102 files changed

+1283
-1290
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+1283
-1290
lines changed

rb/.rubocop_todo.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2016-06-10 10:26:32 -0700 using RuboCop version 0.37.2.
3+
# on 2016-06-10 14:40:50 -0700 using RuboCop version 0.37.2.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
@@ -38,10 +38,3 @@ Metrics/ModuleLength:
3838
# Offense count: 15
3939
Metrics/PerceivedComplexity:
4040
Max: 16
41-
42-
# Offense count: 1398
43-
# Cop supports --auto-correct.
44-
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
45-
# SupportedStyles: single_quotes, double_quotes
46-
Style/StringLiterals:
47-
Enabled: false

rb/lib/selenium/server.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ def download(required_version)
7373
return download_file_name if File.exist? download_file_name
7474

7575
begin
76-
open(download_file_name, "wb") do |destination|
77-
net_http.start("selenium-release.storage.googleapis.com") do |http|
76+
open(download_file_name, 'wb') do |destination|
77+
net_http.start('selenium-release.storage.googleapis.com') do |http|
7878
resp = http.request_get("/#{required_version[/(\d+\.\d+)\./, 1]}/#{download_file_name}") do |response|
7979
total = response.content_length
8080
progress = 0
@@ -113,8 +113,8 @@ def download(required_version)
113113

114114
def latest
115115
require 'rexml/document'
116-
net_http.start("selenium-release.storage.googleapis.com") do |http|
117-
REXML::Document.new(http.get("/").body).root.get_elements("//Contents/Key").map do |e|
116+
net_http.start('selenium-release.storage.googleapis.com') do |http|
117+
REXML::Document.new(http.get('/').body).root.get_elements('//Contents/Key').map do |e|
118118
e.text[/selenium-server-standalone-(\d+\.\d+\.\d+)\.jar/, 1]
119119
end.compact.max
120120
end
@@ -124,7 +124,7 @@ def net_http
124124
http_proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']
125125

126126
if http_proxy
127-
http_proxy = "http://#{http_proxy}" unless http_proxy.start_with?("http://")
127+
http_proxy = "http://#{http_proxy}" unless http_proxy.start_with?('http://')
128128
uri = URI.parse(http_proxy)
129129

130130
Net::HTTP::Proxy(uri.host, uri.port)
@@ -174,7 +174,7 @@ def initialize(jar, opts = {})
174174
raise Errno::ENOENT, jar unless File.exist?(jar)
175175

176176
@jar = jar
177-
@host = "127.0.0.1"
177+
@host = '127.0.0.1'
178178
@port = opts.fetch(:port, 4444)
179179
@timeout = opts.fetch(:timeout, 30)
180180
@background = opts.fetch(:background, false)
@@ -192,7 +192,7 @@ def start
192192

193193
def stop
194194
begin
195-
Net::HTTP.get(@host, "/selenium-server/driver/?cmd=shutDownSeleniumServer", @port)
195+
Net::HTTP.get(@host, '/selenium-server/driver/?cmd=shutDownSeleniumServer', @port)
196196
rescue Errno::ECONNREFUSED
197197
end
198198

@@ -232,11 +232,11 @@ def stop_process
232232

233233
def process
234234
@process ||= (
235-
cp = ChildProcess.build("java", "-jar", @jar, "-port", @port.to_s, *@additional_args)
235+
cp = ChildProcess.build('java', '-jar', @jar, '-port', @port.to_s, *@additional_args)
236236
io = cp.io
237237

238238
if @log.is_a?(String)
239-
@log_file = File.open(@log, "w")
239+
@log_file = File.open(@log, 'w')
240240
io.stdout = io.stderr = @log_file
241241
elsif @log
242242
io.inherit!

rb/lib/selenium/webdriver.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ module WebDriver
4545
# @api private
4646

4747
def self.root
48-
@root ||= File.expand_path("../..", __FILE__)
48+
@root ||= File.expand_path('../..', __FILE__)
4949
end
5050

5151
#

rb/lib/selenium/webdriver/chrome.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
module Selenium
2727
module WebDriver
2828
module Chrome
29-
MISSING_TEXT = "Unable to find the chromedriver executable. Please download the server from http://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH. More info at https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver.".freeze
29+
MISSING_TEXT = 'Unable to find the chromedriver executable. Please download the server from http://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH. More info at https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver.'.freeze
3030

3131
def self.driver_path=(path)
3232
Platform.assert_executable path
@@ -35,7 +35,7 @@ def self.driver_path=(path)
3535

3636
def self.driver_path
3737
@driver_path ||= begin
38-
path = Platform.find_binary("chromedriver")
38+
path = Platform.find_binary('chromedriver')
3939
raise Error::WebDriverError, MISSING_TEXT unless path
4040
Platform.assert_executable path
4141

rb/lib/selenium/webdriver/chrome/bridge.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def create_capabilities(opts)
8989

9090
if args
9191
unless args.is_a? Array
92-
raise ArgumentError, ":args must be an Array of Strings"
92+
raise ArgumentError, ':args must be an Array of Strings'
9393
end
9494

9595
chrome_options['args'] = args.map(&:to_s)
@@ -113,7 +113,7 @@ def create_capabilities(opts)
113113
caps['proxy'] = proxy if proxy
114114

115115
# legacy options - for chromedriver < 17.0.963.0
116-
caps["chrome.switches"] = chrome_options['args'] if chrome_options.member?('args')
116+
caps['chrome.switches'] = chrome_options['args'] if chrome_options.member?('args')
117117
%w[binary detach extensions nativeEvents noWebsiteTestingDefaults prefs profile verbose].each do |key|
118118
caps["chrome.#{key}"] = chrome_options[key] if chrome_options.member?(key)
119119
end

rb/lib/selenium/webdriver/chrome/profile.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,17 @@ def add_encoded_extension(encoded)
5252
#
5353

5454
def []=(key, value)
55-
parts = key.split(".")
55+
parts = key.split('.')
5656
parts[0..-2].inject(prefs) { |a, e| a[e] ||= {} }[parts.last] = value
5757
end
5858

5959
def [](key)
60-
parts = key.split(".")
60+
parts = key.split('.')
6161
parts.inject(prefs) { |a, e| a.fetch(e) }
6262
end
6363

6464
def layout_on_disk
65-
dir = @model ? create_tmp_copy(@model) : Dir.mktmpdir("webdriver-chrome-profile")
65+
dir = @model ? create_tmp_copy(@model) : Dir.mktmpdir('webdriver-chrome-profile')
6666
FileReaper << dir
6767

6868
write_prefs_to dir
@@ -72,7 +72,7 @@ def layout_on_disk
7272

7373
def as_json(opts = nil)
7474
extensions = @extensions.map do |crx_path|
75-
File.open(crx_path, "rb") { |crx_file| Base64.strict_encode64 crx_file.read }
75+
File.open(crx_path, 'rb') { |crx_file| Base64.strict_encode64 crx_file.read }
7676
end
7777

7878
extensions.concat(@encoded_extensions)
@@ -86,7 +86,7 @@ def write_prefs_to(dir)
8686
prefs_file = prefs_file_for(dir)
8787

8888
FileUtils.mkdir_p File.dirname(prefs_file)
89-
File.open(prefs_file, "w") { |file| file << JSON.generate(prefs) }
89+
File.open(prefs_file, 'w') { |file| file << JSON.generate(prefs) }
9090
end
9191

9292
def prefs

rb/lib/selenium/webdriver/chrome/service.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def start_process
3838
end
3939

4040
def stop_server
41-
connect_to_server { |http| http.get("/shutdown") }
41+
connect_to_server { |http| http.get('/shutdown') }
4242
end
4343

4444
def cannot_connect_error_text

rb/lib/selenium/webdriver/common/bridge_helper.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ def parse_cookie_string(str)
5353
'secure' => false
5454
}
5555

56-
str.split(";").each do |attribute|
57-
if attribute.include? "="
58-
key, value = attribute.strip.split("=", 2)
56+
str.split(';').each do |attribute|
57+
if attribute.include? '='
58+
key, value = attribute.strip.split('=', 2)
5959
if result['name'].empty?
6060
result['name'] = key
6161
result['value'] = value
@@ -64,11 +64,11 @@ def parse_cookie_string(str)
6464
elsif key && value
6565
result[key] = value
6666
end
67-
elsif attribute == "secure"
67+
elsif attribute == 'secure'
6868
result['secure'] = true
6969
end
7070

71-
unless [nil, "", "0"].include?(result['expires'])
71+
unless [nil, '', '0'].include?(result['expires'])
7272
# firefox stores expiry as number of seconds
7373
result['expires'] = Time.at(result['expires'].to_i)
7474
end

rb/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def network_connection_type
3232
end
3333

3434
def network_connection_type=(connection_type)
35-
raise ArgumentError, "Invalid connection type" unless valid_type? connection_type
35+
raise ArgumentError, 'Invalid connection type' unless valid_type? connection_type
3636

3737
connection_value = type_to_values[connection_type]
3838

rb/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def screenshot_as(format)
4848
when :base64
4949
bridge.getScreenshot
5050
when :png
51-
bridge.getScreenshot.unpack("m")[0]
51+
bridge.getScreenshot.unpack('m')[0]
5252
else
5353
raise Error::UnsupportedOperationError, "unsupported format: #{format.inspect}"
5454
end

0 commit comments

Comments
 (0)