diff --git a/lib/rubocop/rspec/language/runtime_macros.rb b/lib/rubocop/rspec/language/runtime_macros.rb index 6dd2bc1ca..686cabea3 100644 --- a/lib/rubocop/rspec/language/runtime_macros.rb +++ b/lib/rubocop/rspec/language/runtime_macros.rb @@ -19,7 +19,8 @@ def def_runtime_node_matcher(method_name, &pattern_block) "#{predicate_method?(method_name) ? '!match.nil?' : 'match'};" \ 'end' - location = caller_locations(1, 1).first + location = caller_locations(3, 1).first + puts location class_eval(src, location.path, location.lineno) end @@ -34,7 +35,7 @@ def def_runtime_node_search(method_name, &pattern_block) "node.each_node.public_method(#{search_method})" \ '.call(&pattern.public_method(:match, *args, &block));end' - location = caller_locations(1, 1).first + location = caller_locations(2, 1).first class_eval(src, location.path, location.lineno) end