From 9e7ca20cc4f6f535bc08da411b90d5a7454f67ab Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Wed, 3 Jul 2024 14:43:25 +0900 Subject: [PATCH] Suppress RuboCop offense This commit suppresses the following new RuboCop offense with RuboCop RSpec 3.0.2: ```console $ bundle exec rake (snip) spec/project_spec.rb:27:9: C: [Correctable] RSpec/PredicateMatcher: Prefer using nil? over be_nil matcher. expect(start_with_subject).to( ... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 294 files inspected, 1 offense detected, 1 offense autocorrectable ``` --- spec/project_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/project_spec.rb b/spec/project_spec.rb index e7efaffa46..2b50ae0a0f 100644 --- a/spec/project_spec.rb +++ b/spec/project_spec.rb @@ -24,8 +24,8 @@ start_with_subject = description.match(/\AThis cop (?.+?) .*/) suggestion = start_with_subject[:verb]&.capitalize if start_with_subject suggestion ||= 'a verb' - expect(start_with_subject).to( - be_nil, "`Description` for `#{name}` should be started with `#{suggestion}` instead of `This cop ...`." + expect(start_with_subject.nil?).to( + be(true), "`Description` for `#{name}` should be started with `#{suggestion}` instead of `This cop ...`." ) end end