lib/rubocop/cop/rspec/hook_argument.rb in rubocop-rspec-1.32.0 vs lib/rubocop/cop/rspec/hook_argument.rb in rubocop-rspec-1.33.0
- old
+ new
@@ -57,15 +57,14 @@
# before(:example) do
# # ...
# end
class HookArgument < Cop
include ConfigurableEnforcedStyle
- include RangeHelp
IMPLICIT_MSG = 'Omit the default `%<scope>p` ' \
- 'argument for RSpec hooks.'.freeze
- EXPLICIT_MSG = 'Use `%<scope>p` for RSpec hooks.'.freeze
+ 'argument for RSpec hooks.'
+ EXPLICIT_MSG = 'Use `%<scope>p` for RSpec hooks.'
HOOKS = Hooks::ALL.node_pattern_union.freeze
def_node_matcher :scoped_hook, <<-PATTERN
(block $(send _ #{HOOKS} (sym ${:each :example})) ...)
@@ -123,12 +122,11 @@
def hook(node, &block)
scoped_hook(node, &block) || unscoped_hook(node, &block)
end
def argument_range(send_node)
- range_between(
- send_node.loc.selector.end_pos,
- send_node.loc.expression.end_pos
+ send_node.loc.selector.end.with(
+ end_pos: send_node.loc.expression.end_pos
)
end
end
end
end