lib/rubocop/cop/rspec/let_setup.rb in rubocop-rspec-1.33.0 vs lib/rubocop/cop/rspec/let_setup.rb in rubocop-rspec-1.34.0
- old
+ new
@@ -24,24 +24,22 @@
#
# it 'counts widgets' do
# expect(Widget.count).to eq(1)
# end
class LetSetup < Cop
- include RuboCop::RSpec::TopLevelDescribe
+ MSG = 'Do not use `let!` to setup objects not referenced in tests.'
- MSG = 'Do not use `let!` for test setup.'
-
def_node_search :let_bang, <<-PATTERN
(block $(send nil? :let! (sym $_)) args ...)
PATTERN
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, location: :expression)
+ add_offense(let)
end
end
private