lib/rubocop/cop/rspec/expect_in_hook.rb in rubocop-rspec-1.18.0 vs lib/rubocop/cop/rspec/expect_in_hook.rb in rubocop-rspec-1.19.0
- old
+ new
@@ -23,11 +23,11 @@
class ExpectInHook < Cop
MSG = 'Do not use `%<expect>s` in `%<hook>s` hook'.freeze
HOOKS = Hooks::ALL.node_pattern_union.freeze
def_node_matcher :hook, <<-PATTERN
- (block (send _ $#{HOOKS} ...) _ $!nil)
+ (block (send _ $#{HOOKS} ...) _ $!nil?)
PATTERN
def_node_search :expect, <<-PATTERN
{
#{Expectations::ALL.send_pattern}
@@ -37,11 +37,11 @@
def on_block(node)
hook(node) do |hook_name, body|
expect(body) do |expect|
method = send_node(expect)
- add_offense(method, :selector,
- message(method, hook_name))
+ add_offense(method, location: :selector,
+ message: message(method, hook_name))
end
end
end
private