From e0ec0d021342ce4f791bc5f9b417b98f425fc68d Mon Sep 17 00:00:00 2001 From: Thomas Walpole Date: Wed, 8 May 2019 16:03:57 -0700 Subject: [PATCH] Update rubocop config --- .rubocop.yml | 9 +++------ lib/capybara/selenium/extensions/find.rb | 2 +- lib/capybara/session.rb | 4 ++-- lib/capybara/spec/test_app.rb | 11 ++++++++--- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 709b7eb1d..dfa76a474 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -29,7 +29,8 @@ Metrics/BlockLength: - 'spec/**/*' - 'lib/capybara/spec/**/*' - 'capybara.gemspec' - - 'lib/capybara/selector/definition/*' + ExcludedMethods: + - Capybara.add_selector Metrics/AbcSize: Enabled: false @@ -53,7 +54,7 @@ Metrics/PerceivedComplexity: Enabled: false Metrics/ParameterLists: - CountKeywordArgs: false + CountKeywordArgs: false Lint/UnusedMethodArgument: Exclude: @@ -63,7 +64,6 @@ Lint/UnusedMethodArgument: Layout/EndAlignment: EnforcedStyleAlignWith: variable - Naming/RescuedExceptionsVariableName: # This cop is currently fully broken Enabled: false @@ -99,9 +99,6 @@ Style/Documentation: Style/DoubleNegation: Enabled: false -Style/ClassVars: - Enabled: false - Style/EmptyElse: EnforcedStyle: empty diff --git a/lib/capybara/selenium/extensions/find.rb b/lib/capybara/selenium/extensions/find.rb index 989a66c6a..72daa3c69 100644 --- a/lib/capybara/selenium/extensions/find.rb +++ b/lib/capybara/selenium/extensions/find.rb @@ -87,7 +87,7 @@ def es_context end def is_displayed_atom # rubocop:disable Naming/PredicateName - @@is_displayed_atom ||= begin + @@is_displayed_atom ||= begin # rubocop:disable Style/ClassVars browser.send(:bridge).send(:read_atom, 'isDisplayed') rescue StandardError # If the atom doesn't exist or other error diff --git a/lib/capybara/session.rb b/lib/capybara/session.rb index d36a86e96..4437b7aba 100644 --- a/lib/capybara/session.rb +++ b/lib/capybara/session.rb @@ -77,7 +77,7 @@ class Session def initialize(mode, app = nil) raise TypeError, 'The second parameter to Session::new should be a rack app if passed.' if app && !app.respond_to?(:call) - @@instance_created = true + @@instance_created = true # rubocop:disable Style/ClassVars @mode = mode @app = app if block_given? @@ -807,7 +807,7 @@ def config private - @@instance_created = false + @@instance_created = false # rubocop:disable Style/ClassVars def driver_args(args) args.map { |arg| arg.is_a?(Capybara::Node::Element) ? arg.base : arg } diff --git a/lib/capybara/spec/test_app.rb b/lib/capybara/spec/test_app.rb index 781432460..7e944a83f 100644 --- a/lib/capybara/spec/test_app.rb +++ b/lib/capybara/spec/test_app.rb @@ -18,7 +18,6 @@ def initialize(string1, msg) set :raise_errors, true set :show_exceptions, false - @@form_post_count = 0 # Also check lib/capybara/spec/views/*.erb for pages not listed here get '/' do @@ -176,8 +175,8 @@ def initialize(string1, msg) end post '/form' do - @@form_post_count += 1 - '
' + params[:form].merge('post_count' => @@form_post_count).to_yaml + '
' + self.class.form_post_count += 1 + '
' + params[:form].merge('post_count' => self.class.form_post_count).to_yaml + '
' end post '/upload_empty' do @@ -212,6 +211,12 @@ def initialize(string1, msg) 'No files uploaded' end end + + class << self + attr_accessor :form_post_count + end + + @form_post_count = 0 end Rack::Handler::Puma.run TestApp, Port: 8070 if $PROGRAM_NAME == __FILE__