From 8d500357729177961a9592c2fa17da5c7fc1a7ef Mon Sep 17 00:00:00 2001 From: ydah <13041216+ydah@users.noreply.github.com> Date: Sat, 26 Aug 2023 00:41:34 +0900 Subject: [PATCH] Use offense instead of violation Follow up: https://github.com/rubocop/rubocop-rspec/pull/1680 --- .rubocop.yml | 6 ++++++ .../cop/capybara/current_path_expectation_spec.rb | 12 ++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 04c7af0..51e78b8 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -68,6 +68,9 @@ Naming/InclusiveLanguage: auto_correct: Suggestions: - autocorrect + ' a violation': + Suggestions: + - an offense behaviour: Suggestions: - behavior @@ -77,6 +80,9 @@ Naming/InclusiveLanguage: 'does not registers': Suggestions: - does not register + violation: + Suggestions: + - offense RSpec: Language: diff --git a/spec/rubocop/cop/capybara/current_path_expectation_spec.rb b/spec/rubocop/cop/capybara/current_path_expectation_spec.rb index c9aac93..ba78f22 100644 --- a/spec/rubocop/cop/capybara/current_path_expectation_spec.rb +++ b/spec/rubocop/cop/capybara/current_path_expectation_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe RuboCop::Cop::Capybara::CurrentPathExpectation do - it 'flags violations for `expect(current_path)`' do + it 'flags offenses for `expect(current_path)`' do expect_offense(<<~RUBY) expect(current_path).to eq "/callback" ^^^^^^ Do not set an RSpec expectation on `current_path` in Capybara feature specs - instead, use the `have_current_path` matcher on `page` @@ -12,7 +12,7 @@ RUBY end - it 'flags violations for `expect(current_path)` with ' \ + it 'flags offenses for `expect(current_path)` with ' \ 'a multi-line string argument' do expect_offense(<<~'RUBY') expect(current_path).to eq "/callback" \ @@ -26,7 +26,7 @@ RUBY end - it 'flags violations for `expect(current_path)` with a `command`' do + it 'flags offenses for `expect(current_path)` with a `command`' do expect_offense(<<~RUBY) expect(current_path).to eq `pwd` ^^^^^^ Do not set an RSpec expectation on `current_path` in Capybara feature specs - instead, use the `have_current_path` matcher on `page` @@ -37,7 +37,7 @@ RUBY end - it 'flags violations for `expect(page.current_path)`' do + it 'flags offenses for `expect(page.current_path)`' do expect_offense(<<-RUBY) expect(page.current_path).to eq("/callback") ^^^^^^ Do not set an RSpec expectation on `current_path` in Capybara feature specs - instead, use the `have_current_path` matcher on `page` @@ -203,13 +203,13 @@ RUBY end - it "doesn't flag a violation for other expectations" do + it "doesn't flag an offense for other expectations" do expect_no_offenses(<<-RUBY) expect(current_user).to eq(user) RUBY end - it "doesn't flag a violation for other references to `current_path`" do + it "doesn't flag an offense for other references to `current_path`" do expect_no_offenses(<<-RUBY) current_path = WalkingRoute.last.path RUBY