RSpec/MultipleExpectations: ひとつの example に 10件まで expect を書けるようにする#101
Open
tk0miya wants to merge 1 commit intotimedia:masterfrom
Open
RSpec/MultipleExpectations: ひとつの example に 10件まで expect を書けるようにする#101tk0miya wants to merge 1 commit intotimedia:masterfrom
tk0miya wants to merge 1 commit intotimedia:masterfrom
Conversation
さまざまなデータを扱う Web ページでは複数の変更が行われるため、複数の expect を並べることはよく行われていることです。 標準では 1件までしか expect を書くべきではないとする RSpec/MultipleExpectations を 10件まで許容するように変更します。 (10件という値に特別な意味はありません。5件では少ないだろうという直感によ るものです)
Member
|
system spec / request spec では複数 expectation も分かるんですが、 それ以外の spec は基本「単体テスト相当のテストコード」となるべきで、複数 expectation が出現したら「メソッドの分割が甘い/副作用が大きすぎる」を疑うべきなのかなあと。 なので、
が私の意見です |
Member
rubocop-rspec のデフォルト設定で↓みたいに書かれてるのを見ちゃったので、 https://github.com/timedia/styleguide/blob/master/ruby/rubocop/config/rspec.yml に |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
さまざまなデータを扱う Web ページでは複数の変更が行われるため、複数の
expect を並べることはよく行われていることです。
標準では 1件までしか expect を書くべきではないとする
RSpec/MultipleExpectations を 10件まで許容するように変更します。
(10件という値に特別な意味はありません。5件では少ないだろうという直感によ
るものです)