Skip to content

Commit

Permalink
Minor rubocop changes [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
twalpole committed May 30, 2019
1 parent bdaed0b commit 320ee96
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ Layout/CaseIndentation:
Layout/IndentFirstArrayElement:
EnforcedStyle: consistent

Layout/IndentationWidth:
IgnoredPatterns: ['^\s*module']

Security/YAMLLoad:
Exclude:
- 'lib/capybara/spec/**/*'
Expand Down
2 changes: 1 addition & 1 deletion lib/capybara/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Capybara
# @api private
module Helpers
module_function # rubocop:disable Layout/IndentationWidth
module_function

##
# @deprecated
Expand Down
4 changes: 2 additions & 2 deletions lib/capybara/node/actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,12 @@ def find_select_or_datalist_input(from, options)
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
raise if %i[selected with_selected multiple].any? { |option| options.key?(option) }

begin
find(:datalist_input, from, options)
rescue Capybara::ElementNotFound => dlinput_error # _rubocop:disable Naming/RescuedExceptionsVariableName
rescue Capybara::ElementNotFound => dlinput_error
raise Capybara::ElementNotFound, "#{select_error.message} and #{dlinput_error.message}"
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/capybara/queries/selector_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def matches_filters?(node, node_filter_errors = [])
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 : [])
false
end

Expand Down
2 changes: 1 addition & 1 deletion lib/capybara/selenium/extensions/html5_drag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Capybara::Selenium::Node
module Html5Drag
# Implement methods to emulate HTML5 drag and drop

private # rubocop:disable Layout/IndentationWidth
private

def html5_drag_to(element)
driver.execute_script MOUSEDOWN_TRACKER
Expand Down
2 changes: 1 addition & 1 deletion lib/capybara/selenium/patches/atoms.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module CapybaraAtoms
private # rubocop:disable Layout/IndentationWidth
private

def read_atom(function)
@atoms ||= Hash.new do |hash, key|
Expand Down
2 changes: 1 addition & 1 deletion lib/capybara/server/checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def initialize(host, port)

def request(&block)
ssl? ? https_request(&block) : http_request(&block)
rescue *TRY_HTTPS_ERRORS # _rubocop:disable Naming/RescuedExceptionsVariableName
rescue *TRY_HTTPS_ERRORS
res = https_request(&block)
@ssl = true
res
Expand Down
4 changes: 1 addition & 3 deletions lib/capybara/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -736,9 +736,7 @@ def save_screenshot(path = nil, **options)
# @param [Hash] options a customizable set of options
#
def save_and_open_screenshot(path = nil, **options)
# rubocop:disable Lint/Debugger
save_screenshot(path, options).tap { |s_path| open_file(s_path) }
# rubocop:enable Lint/Debugger
save_screenshot(path, options).tap { |s_path| open_file(s_path) } # rubocop:disable Lint/Debugger
end

def document
Expand Down
2 changes: 1 addition & 1 deletion lib/capybara/window.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def closed?
# @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
false
end

Expand Down

0 comments on commit 320ee96

Please sign in to comment.