Skip to content

Commit

Permalink
Minor rubocop updates
Browse files Browse the repository at this point in the history
  • Loading branch information
twalpole committed Nov 16, 2020
1 parent e8f7189 commit 54b0081
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,11 @@ Performance/Squeeze:
Performance/StringInclude:
Enabled: true


Performance/MethodObjectAsBlock:
Enabled: false

Performance/BlockGivenWithExplicitBlock:
Enabled: false

RSpec/ExampleWording:
Enabled: false
Expand Down
2 changes: 1 addition & 1 deletion lib/capybara/result.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def initialize(elements, query)
alias index find_index

def each(&block)
return enum_for(:each) unless block_given?
return enum_for(:each) unless block

@result_cache.each(&block)
loop do
Expand Down
2 changes: 1 addition & 1 deletion lib/capybara/rspec/matcher_proxies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def all(*args, **kwargs, &block)
end

def within(*args, **kwargs, &block)
if block_given?
if block
within_element(*args, **kwargs, &block)
else
be_within(*args)
Expand Down
2 changes: 1 addition & 1 deletion lib/capybara/selector/definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def filter_set(name, filters_to_use = nil)
def_delegator :@filter_set, :describe

def describe_expression_filters(&block)
if block_given?
if block
describe(:expression_filters, &block)
else
describe(:expression_filters) do |**options|
Expand Down
4 changes: 2 additions & 2 deletions lib/capybara/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,8 @@ def open_new_window(kind = :tab)
# @raise [ArgumentError] if both or neither arguments were provided
#
def switch_to_window(window = nil, **options, &window_locator)
raise ArgumentError, '`switch_to_window` can take either a block or a window, not both' if window && block_given?
raise ArgumentError, '`switch_to_window`: either window or block should be provided' if !window && !block_given?
raise ArgumentError, '`switch_to_window` can take either a block or a window, not both' if window && window_locator
raise ArgumentError, '`switch_to_window`: either window or block should be provided' if !window && !window_locator

unless scopes.last.nil?
raise Capybara::ScopeError, '`switch_to_window` is not supposed to be invoked from '\
Expand Down

0 comments on commit 54b0081

Please sign in to comment.