1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Update for lastest rubocop

This commit is contained in:
Thomas Walpole 2019-11-28 12:19:37 -08:00
parent ba8fc4cd63
commit eec7fa65d1
6 changed files with 13 additions and 13 deletions

View file

@ -69,7 +69,7 @@ Naming/PredicateName:
Exclude:
- '**/*/*matchers.rb'
Naming/UncommunicativeMethodParamName:
Naming/MethodParameterName:
AllowedNames:
- 'el'
- 'id'
@ -124,7 +124,7 @@ Layout/AccessModifierIndentation:
Layout/CaseIndentation:
EnforcedStyle: end
Layout/IndentFirstArrayElement:
Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent
Layout/IndentationWidth:

View file

@ -359,7 +359,7 @@ module Capybara
def _reset_style(element)
element.execute_script(RESET_STYLE_SCRIPT)
rescue StandardError # rubocop:disable Lint/HandleExceptions swallow extra errors
rescue StandardError # rubocop:disable Lint/SuppressedException swallow extra errors
end
def _check_with_label(selector, checked, locator,

View file

@ -145,7 +145,7 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
switch_to_frame(:parent)
begin
return frame.base.obscured?(x: x, y: y)
frame.base.obscured?(x: x, y: y)
ensure
switch_to_frame(frame)
end
@ -240,7 +240,7 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
def quit
@browser&.quit
rescue Selenium::WebDriver::Error::SessionNotCreatedError, Errno::ECONNREFUSED # rubocop:disable Lint/HandleExceptions
rescue Selenium::WebDriver::Error::SessionNotCreatedError, Errno::ECONNREFUSED # rubocop:disable Lint/SuppressedException
# Browser must have already gone
rescue Selenium::WebDriver::Error::UnknownError => e
unless silenced_unknown_error_message?(e.message) # Most likely already gone
@ -292,7 +292,7 @@ private
def clear_browser_state
delete_all_cookies
clear_storage
rescue *clear_browser_state_errors # rubocop:disable Lint/HandleExceptions
rescue *clear_browser_state_errors # rubocop:disable Lint/SuppressedException
# delete_all_cookies fails when we've previously gone
# to about:blank, so we rescue this error and do nothing
# instead.
@ -316,7 +316,7 @@ private
def clear_storage
clear_session_storage unless options[:clear_session_storage] == false
clear_local_storage unless options[:clear_local_storage] == false
rescue Selenium::WebDriver::Error::JavascriptError # rubocop:disable Lint/HandleExceptions
rescue Selenium::WebDriver::Error::JavascriptError # rubocop:disable Lint/SuppressedException
# session/local storage may not be available if on non-http pages (e.g. about:blank)
end
@ -352,7 +352,7 @@ private
@browser.navigate.to(url)
sleep 0.1 # slight wait for alert
@browser.switch_to.alert.accept
rescue modal_error # rubocop:disable Lint/HandleExceptions
rescue modal_error # rubocop:disable Lint/SuppressedException
# alert now gone, should mean navigation happened
end

View file

@ -46,7 +46,7 @@ module Capybara::Selenium::Driver::W3CFirefoxDriver
begin
# Firefox 68 hangs if we try to switch windows while a modal is visible
browser.switch_to.alert&.dismiss
rescue Selenium::WebDriver::Error::NoSuchAlertError # rubocop:disable Lint/HandleExceptions
rescue Selenium::WebDriver::Error::NoSuchAlertError # rubocop:disable Lint/SuppressedException
# Swallow
end
end
@ -61,7 +61,7 @@ module Capybara::Selenium::Driver::W3CFirefoxDriver
accept_modal :confirm, wait: 0.1 do
super
end
rescue Capybara::ModalNotFound # rubocop:disable Lint/HandleExceptions
rescue Capybara::ModalNotFound # rubocop:disable Lint/SuppressedException
# No modal was opened - page has refreshed - ignore
end

View file

@ -204,7 +204,7 @@ protected
JS
begin
driver.execute_script(script, self)
rescue StandardError # rubocop:disable Lint/HandleExceptions
rescue StandardError # rubocop:disable Lint/SuppressedException
# Swallow error if scrollIntoView with options isn't supported
end
end

View file

@ -92,7 +92,7 @@ RSpec.describe Capybara::DSL do
driver_before_block = Capybara.current_driver
begin
Capybara.using_driver(:selenium) { raise 'ohnoes!' }
rescue Exception # rubocop:disable Lint/RescueException,Lint/HandleExceptions
rescue Exception # rubocop:disable Lint/RescueException,Lint/SuppressedException
end
expect(Capybara.current_driver).to eq(driver_before_block)
end
@ -208,7 +208,7 @@ RSpec.describe Capybara::DSL do
Capybara.using_session(:raise) do
raise
end
rescue Exception # rubocop:disable Lint/RescueException,Lint/HandleExceptions
rescue Exception # rubocop:disable Lint/RescueException,Lint/SuppressedException
end
expect(Capybara.session_name).to eq(:default)
end