The project is in a healthy, maintained state
Custom cops that define rules for rspec descriptions
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

>= 1.72.2
 Project Readme

rubocop-rspec_enforce_description

RSpecの各ブロックの説明文のルールを提供するRuboCop用のGemです。 テスト記述の統一や可読性向上に役立ちます。

インストール

bundle add rubocop-rspec_enforce_description

.rubocop.ymlへの設定

require:
  - rubocop-rspec_enforce_description

RSpec/EnforceDescription:
  Enabled: true

ルール

contextの説明文の最後が「場合」になっていること

context 'ログインしているとき' do
  # ...
end
# ↑ 警告: Context description should end with [場合].

itの説明文の最後が「こと」になっていること

it '大文字になります' do
  # ...
end
# ↑ 警告: It description should end with [こと].