lib/rubocop/cop/rspec/around_block.rb in rubocop-rspec-1.18.0 vs lib/rubocop/cop/rspec/around_block.rb in rubocop-rspec-1.19.0
- old
+ new
@@ -27,11 +27,11 @@
MSG_NO_ARG = 'Test object should be passed to around block.'.freeze
MSG_UNUSED_ARG = 'You should call `%<arg>s.call` '\
'or `%<arg>s.run`.'.freeze
def_node_matcher :hook, <<-PATTERN
- (block {(send nil :around) (send nil :around sym)} (args $...) ...)
+ (block {(send nil? :around) (send nil? :around sym)} (args $...) ...)
PATTERN
def_node_search :find_arg_usage, <<-PATTERN
{(send $... {:call :run}) (send _ _ $...) (yield $...) (block-pass $...)}
PATTERN
@@ -47,20 +47,24 @@
end
private
def add_no_arg_offense(node)
- add_offense(node, :expression, MSG_NO_ARG)
+ add_offense(node, location: :expression, message: MSG_NO_ARG)
end
def check_for_unused_proxy(block, proxy)
name, = *proxy
find_arg_usage(block) do |usage|
return if usage.include?(s(:lvar, name))
end
- add_offense(proxy, :expression, format(MSG_UNUSED_ARG, arg: name))
+ add_offense(
+ proxy,
+ location: :expression,
+ message: format(MSG_UNUSED_ARG, arg: name)
+ )
end
end
end
end
end