lib/rubocop/cop/rspec/multiple_subjects.rb in rubocop-rspec-1.18.0 vs lib/rubocop/cop/rspec/multiple_subjects.rb in rubocop-rspec-1.19.0
- old
+ new
@@ -35,19 +35,19 @@
# a `before` hook on their own
class MultipleSubjects < Cop
MSG = 'Do not set more than one subject per example group'.freeze
def_node_matcher :named_subject?, <<-PATTERN
- (block (send nil :subject $sym) args ...)
+ (block (send nil? :subject $sym) args ...)
PATTERN
def on_block(node)
return unless example_group?(node)
subjects = RuboCop::RSpec::ExampleGroup.new(node).subjects
subjects[0...-1].each do |subject|
- add_offense(subject, :expression)
+ add_offense(subject, location: :expression)
end
end
def autocorrect(node)
return unless node.method_name.equal?(:subject) # Ignore `subject!`