Skip to content

Commit

Permalink
Update rubocop config
Browse files Browse the repository at this point in the history
  • Loading branch information
twalpole committed May 9, 2019
1 parent 8ec78ab commit e0ec0d0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
9 changes: 3 additions & 6 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ Metrics/BlockLength:
- 'spec/**/*'
- 'lib/capybara/spec/**/*'
- 'capybara.gemspec'
- 'lib/capybara/selector/definition/*'
ExcludedMethods:
- Capybara.add_selector

Metrics/AbcSize:
Enabled: false
Expand All @@ -53,7 +54,7 @@ Metrics/PerceivedComplexity:
Enabled: false

Metrics/ParameterLists:
CountKeywordArgs: false
CountKeywordArgs: false

Lint/UnusedMethodArgument:
Exclude:
Expand All @@ -63,7 +64,6 @@ Lint/UnusedMethodArgument:
Layout/EndAlignment:
EnforcedStyleAlignWith: variable


Naming/RescuedExceptionsVariableName:
# This cop is currently fully broken
Enabled: false
Expand Down Expand Up @@ -99,9 +99,6 @@ Style/Documentation:
Style/DoubleNegation:
Enabled: false

Style/ClassVars:
Enabled: false

Style/EmptyElse:
EnforcedStyle: empty

Expand Down
2 changes: 1 addition & 1 deletion lib/capybara/selenium/extensions/find.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/capybara/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -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 }
Expand Down
11 changes: 8 additions & 3 deletions lib/capybara/spec/test_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -176,8 +175,8 @@ def initialize(string1, msg)
end

post '/form' do
@@form_post_count += 1
'<pre id="results">' + params[:form].merge('post_count' => @@form_post_count).to_yaml + '</pre>'
self.class.form_post_count += 1
'<pre id="results">' + params[:form].merge('post_count' => self.class.form_post_count).to_yaml + '</pre>'
end

post '/upload_empty' do
Expand Down Expand Up @@ -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__

0 comments on commit e0ec0d0

Please sign in to comment.