lib/rubocop/cop/rspec/let_setup.rb in rubocop-rspec-1.18.0 vs lib/rubocop/cop/rspec/let_setup.rb in rubocop-rspec-1.19.0
- old
+ new
@@ -28,18 +28,20 @@
class LetSetup < Cop
include RuboCop::RSpec::TopLevelDescribe
MSG = 'Do not use `let!` for test setup.'.freeze
- def_node_search :let_bang, '(block $(send nil :let! (sym $_)) args ...)'
+ def_node_search :let_bang, <<-PATTERN
+ (block $(send nil? :let! (sym $_)) args ...)
+ PATTERN
- def_node_search :method_called?, '(send nil %)'
+ def_node_search :method_called?, '(send nil? %)'
def on_block(node)
return unless example_group?(node)
unused_let_bang(node) do |let|
- add_offense(let, :expression)
+ add_offense(let, location: :expression)
end
end
private