lib/rubocop/cop/rspec/let_setup.rb in rubocop-rspec-2.2.0 vs lib/rubocop/cop/rspec/let_setup.rb in rubocop-rspec-2.3.0
- old
+ new
@@ -26,25 +26,28 @@
# expect(Widget.count).to eq(1)
# end
class LetSetup < Base
MSG = 'Do not use `let!` to setup objects not referenced in tests.'
+ # @!method example_or_shared_group_or_including?(node)
def_node_matcher :example_or_shared_group_or_including?,
block_pattern(<<~PATTERN)
{
#SharedGroups.all
#ExampleGroups.all
#Includes.all
}
PATTERN
+ # @!method let_bang(node)
def_node_matcher :let_bang, <<-PATTERN
{
(block $(send nil? :let! {(sym $_) (str $_)}) ...)
$(send nil? :let! {(sym $_) (str $_)} block_pass)
}
PATTERN
+ # @!method method_called?(node)
def_node_search :method_called?, '(send nil? %)'
def on_block(node)
return unless example_or_shared_group_or_including?(node)