Skip to content

Commit

Permalink
Merge pull request #62 from rubocop/use_offense
Browse files Browse the repository at this point in the history
Use offense instead of violation
  • Loading branch information
pirj authored Aug 25, 2023
2 parents 31bd569 + 8d50035 commit abb78b6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ Naming/InclusiveLanguage:
auto_correct:
Suggestions:
- autocorrect
' a violation':
Suggestions:
- an offense
behaviour:
Suggestions:
- behavior
Expand All @@ -77,6 +80,9 @@ Naming/InclusiveLanguage:
'does not registers':
Suggestions:
- does not register
violation:
Suggestions:
- offense

RSpec:
Language:
Expand Down
12 changes: 6 additions & 6 deletions spec/rubocop/cop/capybara/current_path_expectation_spec.rb
Original file line number Diff line number Diff line change
@@ -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`
Expand All @@ -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" \
Expand All @@ -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`
Expand All @@ -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`
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit abb78b6

Please sign in to comment.