lib/rubocop/cop/rspec/leading_subject.rb in rubocop-rspec-2.12.1 vs lib/rubocop/cop/rspec/leading_subject.rb in rubocop-rspec-2.13.0
- old
+ new
@@ -5,40 +5,40 @@
module RSpec
# Enforce that subject is the first definition in the test.
#
# @example
# # bad
- # let(:params) { blah }
- # subject { described_class.new(params) }
+ # let(:params) { blah }
+ # subject { described_class.new(params) }
#
- # before { do_something }
- # subject { described_class.new(params) }
+ # before { do_something }
+ # subject { described_class.new(params) }
#
- # it { expect_something }
- # subject { described_class.new(params) }
- # it { expect_something_else }
+ # it { expect_something }
+ # subject { described_class.new(params) }
+ # it { expect_something_else }
#
#
# # good
- # subject { described_class.new(params) }
- # let(:params) { blah }
+ # subject { described_class.new(params) }
+ # let(:params) { blah }
#
# # good
- # subject { described_class.new(params) }
- # before { do_something }
+ # subject { described_class.new(params) }
+ # before { do_something }
#
# # good
- # subject { described_class.new(params) }
- # it { expect_something }
- # it { expect_something_else }
+ # subject { described_class.new(params) }
+ # it { expect_something }
+ # it { expect_something_else }
#
class LeadingSubject < Base
extend AutoCorrector
include InsideExampleGroup
MSG = 'Declare `subject` above any other `%<offending>s` declarations.'
- def on_block(node)
+ def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler
return unless subject?(node)
return unless inside_example_group?(node)
check_previous_nodes(node)
end