lib/rubocop/cop/rspec/named_subject.rb in rubocop-rspec-2.12.1 vs lib/rubocop/cop/rspec/named_subject.rb in rubocop-rspec-2.13.0
- old
+ new
@@ -39,10 +39,11 @@
# RSpec.describe Foo do
# subject(:user) { described_class.new }
#
# it { is_expected.to be_valid }
# end
+ #
class NamedSubject < Base
MSG = 'Name your test subject if you need to reference it explicitly.'
# @!method example_or_hook_block?(node)
def_node_matcher :example_or_hook_block?,
@@ -53,10 +54,10 @@
block_pattern('#SharedGroups.examples')
# @!method subject_usage(node)
def_node_search :subject_usage, '$(send nil? :subject)'
- def on_block(node)
+ def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler
if !example_or_hook_block?(node) || ignored_shared_example?(node)
return
end
subject_usage(node) do |subject_node|