mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Update to rubocop 0.68
This commit is contained in:
parent
9931c2bd5d
commit
32297d027c
10 changed files with 21 additions and 18 deletions
|
@ -19,7 +19,7 @@ Metrics/LineLength:
|
|||
- 'lib/capybara/spec/**/*'
|
||||
- 'lib/capybara/selector.rb'
|
||||
IgnoredPatterns:
|
||||
- '\s+# rubocop'
|
||||
- '\s+# _?rubocop'
|
||||
- '^\s*#'
|
||||
- '^\s*(raise|warn) '
|
||||
Max: 120
|
||||
|
@ -63,6 +63,11 @@ Lint/UnusedMethodArgument:
|
|||
Layout/EndAlignment:
|
||||
EnforcedStyleAlignWith: variable
|
||||
|
||||
|
||||
Naming/RescuedExceptionsVariableName:
|
||||
# This cop is currently fully broken
|
||||
Enabled: false
|
||||
|
||||
Naming/PredicateName:
|
||||
Exclude:
|
||||
- '**/*/*matchers.rb'
|
||||
|
@ -121,7 +126,7 @@ Layout/AccessModifierIndentation:
|
|||
Layout/CaseIndentation:
|
||||
EnforcedStyle: end
|
||||
|
||||
Layout/IndentArray:
|
||||
Layout/IndentFirstArrayElement:
|
||||
EnforcedStyle: consistent
|
||||
|
||||
Security/YAMLLoad:
|
||||
|
|
|
@ -300,12 +300,12 @@ module Capybara
|
|||
synchronize(Capybara::Queries::BaseQuery.wait(options, session_options.default_max_wait_time)) do
|
||||
begin
|
||||
find(:select, from, options)
|
||||
rescue Capybara::ElementNotFound => select_error # rubocop:disable Naming/RescuedExceptionsVariableName
|
||||
rescue Capybara::ElementNotFound => select_error # _rubocop:disable Naming/RescuedExceptionsVariableName
|
||||
raise if %i[selected with_selected multiple].any? { |option| options.key?(option) }
|
||||
|
||||
begin
|
||||
find(:datalist_input, from, options)
|
||||
rescue Capybara::ElementNotFound => dlinput_error
|
||||
rescue Capybara::ElementNotFound => dlinput_error # _rubocop:disable Naming/RescuedExceptionsVariableName
|
||||
raise Capybara::ElementNotFound, "#{select_error.message} and #{dlinput_error.message}"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -480,9 +480,7 @@ module Capybara
|
|||
%(#<Capybara::Node::Element tag="#{base.tag_name}" path="#{base.path}">)
|
||||
rescue NotSupportedByDriverError
|
||||
%(#<Capybara::Node::Element tag="#{base.tag_name}">)
|
||||
rescue StandardError => err
|
||||
raise unless session.driver.invalid_element_errors.any? { |et| err.is_a?(et) }
|
||||
|
||||
rescue *session.driver.invalid_element_errors
|
||||
%(Obsolete #<Capybara::Node::Element>)
|
||||
end
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ module Capybara
|
|||
matches_system_filters?(node) &&
|
||||
matches_node_filters?(node, node_filter_errors) &&
|
||||
matches_filter_block?(node)
|
||||
rescue *(node.respond_to?(:session) ? node.session.driver.invalid_element_errors : []) # rubocop:disable Naming/RescuedExceptionsVariableName
|
||||
rescue *(node.respond_to?(:session) ? node.session.driver.invalid_element_errors : []) # _rubocop:disable Naming/RescuedExceptionsVariableName
|
||||
false
|
||||
end
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ class Capybara::RackTest::Node < Capybara::Driver::Node
|
|||
|
||||
public_instance_methods(false).each do |meth_name|
|
||||
alias_method "unchecked_#{meth_name}", meth_name
|
||||
private "unchecked_#{meth_name}" # rubocop:disable Layout/AccessModifierIndentation,Style/AccessModifierDeclarations
|
||||
private "unchecked_#{meth_name}" # rubocop:disable Style/AccessModifierDeclarations
|
||||
|
||||
define_method meth_name do |*args|
|
||||
stale_check
|
||||
|
|
|
@ -48,8 +48,8 @@ module Capybara
|
|||
|
||||
def does_not_match?(actual)
|
||||
element_does_not_match?(wrap(actual))
|
||||
rescue Capybara::ExpectationNotMet => err
|
||||
@failure_message_when_negated = err.message
|
||||
rescue Capybara::ExpectationNotMet => e
|
||||
@failure_message_when_negated = e.message
|
||||
false
|
||||
end
|
||||
|
||||
|
|
|
@ -226,10 +226,10 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
|
|||
@browser&.quit
|
||||
rescue Selenium::WebDriver::Error::SessionNotCreatedError, Errno::ECONNREFUSED # rubocop:disable Lint/HandleExceptions
|
||||
# Browser must have already gone
|
||||
rescue Selenium::WebDriver::Error::UnknownError => err
|
||||
unless silenced_unknown_error_message?(err.message) # Most likely already gone
|
||||
rescue Selenium::WebDriver::Error::UnknownError => e
|
||||
unless silenced_unknown_error_message?(e.message) # Most likely already gone
|
||||
# probably already gone but not sure - so warn
|
||||
warn "Ignoring Selenium UnknownError during driver quit: #{err.message}"
|
||||
warn "Ignoring Selenium UnknownError during driver quit: #{e.message}"
|
||||
end
|
||||
ensure
|
||||
@browser = nil
|
||||
|
|
|
@ -18,8 +18,8 @@ module Capybara::Selenium::Driver::ChromeDriver
|
|||
|
||||
def resize_window_to(handle, width, height)
|
||||
super
|
||||
rescue Selenium::WebDriver::Error::UnknownError => err
|
||||
raise unless err.message.match?(/failed to change window state/)
|
||||
rescue Selenium::WebDriver::Error::UnknownError => e
|
||||
raise unless e.message.match?(/failed to change window state/)
|
||||
|
||||
# Chromedriver doesn't wait long enough for state to change when coming out of fullscreen
|
||||
# and raises unnecessary error. Wait a bit and try again.
|
||||
|
|
|
@ -12,7 +12,7 @@ module Capybara
|
|||
|
||||
def request(&block)
|
||||
ssl? ? https_request(&block) : http_request(&block)
|
||||
rescue *TRY_HTTPS_ERRORS # rubocop:disable Naming/RescuedExceptionsVariableName
|
||||
rescue *TRY_HTTPS_ERRORS # _rubocop:disable Naming/RescuedExceptionsVariableName
|
||||
res = https_request(&block)
|
||||
@ssl = true
|
||||
res
|
||||
|
|
|
@ -49,7 +49,7 @@ module Capybara
|
|||
# @return [Boolean] whether this window is the window in which commands are being executed
|
||||
def current?
|
||||
@driver.current_window_handle == @handle
|
||||
rescue @driver.no_such_window_error # rubocop:disable Naming/RescuedExceptionsVariableName
|
||||
rescue @driver.no_such_window_error # _rubocop:disable Naming/RescuedExceptionsVariableName
|
||||
false
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue