lib/rubocop/cop/rspec/subject_stub.rb in rubocop-rspec-2.0.0 vs lib/rubocop/cop/rspec/subject_stub.rb in rubocop-rspec-2.0.1

- old
+ new

@@ -11,14 +11,24 @@ # @see https://samphippen.com/introducing-rspec-smells-and-where-to-find-them#smell-1-stubject # @see https://github.com/rubocop-hq/rspec-style-guide#dont-stub-subject # # @example # # bad - # describe Foo do - # subject(:bar) { baz } + # describe Article do + # subject(:article) { Article.new } # - # before do - # allow(bar).to receive(:qux?).and_return(true) + # it 'indicates that the author is unknown' do + # allow(article).to receive(:author).and_return(nil) + # expect(article.description).to include('by an unknown author') + # end + # end + # + # # good + # describe Article do + # subject(:article) { Article.new(author: nil) } + # + # it 'indicates that the author is unknown' do + # expect(article.description).to include('by an unknown author') # end # end # class SubjectStub < Base include TopLevelGroup