lib/quke/driver_configuration.rb in quke-0.6.0 vs lib/quke/driver_configuration.rb in quke-0.7.0

- old
+ new

@@ -1,7 +1,9 @@ -require 'quke/configuration' +# frozen_string_literal: true +require "quke/configuration" + module Quke #:nodoc: # Helper class that manages the options, switches and capabilities for each of # the different drivers. class DriverConfiguration @@ -103,13 +105,13 @@ def phantomjs # For future reference the options we pass through to phantomjs appear to # mirror those you can actually supply on the command line. # http://phantomjs.org/api/command-line.html options = [ - '--load-images=no', - '--disk-cache=false', - '--ignore-ssl-errors=yes' + "--load-images=no", + "--disk-cache=false", + "--ignore-ssl-errors=yes" ] options.push("--proxy=#{config.proxy['host']}:#{config.proxy['port']}") if config.use_proxy? options @@ -138,26 +140,24 @@ # app, # browser: :chrome, # switches: my_driver_config.chrome # ) # - # rubocop:disable Metrics/AbcSize def chrome result = [] - host = config.proxy['host'] - port = config.proxy['port'] - no_proxy = config.proxy['no_proxy'].tr(',', ';') + host = config.proxy["host"] + port = config.proxy["port"] + no_proxy = config.proxy["no_proxy"].tr(",", ";") result.push("--proxy-server=#{host}:#{port}") if config.use_proxy? - result.push("--proxy-bypass-list=#{no_proxy}") unless config.proxy['no_proxy'].empty? + result.push("--proxy-bypass-list=#{no_proxy}") unless config.proxy["no_proxy"].empty? result.push("--user-agent=#{config.user_agent}") unless config.user_agent.empty? result end - # rubocop:enable Metrics/AbcSize # Returns an instance of Selenium::WebDriver::Remote::Capabilities to be # used when registering an instance of Capybara::Selenium::Driver, # configured to run using Firefox (the default). # @@ -182,26 +182,24 @@ # Capybara::Selenium::Driver.new( # app, # profile: my_driver_config.firefox # ) # - # rubocop:disable Metrics/AbcSize def firefox profile = Selenium::WebDriver::Firefox::Profile.new settings = {} settings[:http] = "#{config.proxy['host']}:#{config.proxy['port']}" if config.use_proxy? settings[:ssl] = settings[:http] if config.use_proxy? - settings[:no_proxy] = config.proxy['no_proxy'] unless config.proxy['no_proxy'].empty? + settings[:no_proxy] = config.proxy["no_proxy"] unless config.proxy["no_proxy"].empty? profile.proxy = Selenium::WebDriver::Proxy.new(settings) if config.use_proxy? - profile['general.useragent.override'] = config.user_agent unless config.user_agent.empty? + profile["general.useragent.override"] = config.user_agent unless config.user_agent.empty? profile end - # rubocop:enable Metrics/AbcSize # Returns an instance of Selenium::WebDriver::Remote::Capabilities to be # used when registering an instance of Capybara::Selenium::Driver, # configured to run using the Browserstack[https://www.browserstack.com/] # service.