Skip to content

Commit

Permalink
[Fix rubocop#1337] Update the cop to raise error for insufficient des…
Browse files Browse the repository at this point in the history
…criptions.
  • Loading branch information
Akshaya Kumar committed Aug 5, 2022
1 parent ce792b8 commit 0cbe7ad
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions spec/rubocop/cop/rspec/example_wording_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,35 @@
end
RUBY
end

context 'when `DisallowedExamples: Workz`' do
let(:cop_config) { { 'DisallowedExamples' => ['Workz'] } }

it 'flags an unclear description' do
expect_offense(<<-'RUBY')
it "workz" \
^^^^^^^^ Your test should be more descriptive.
"with #{object}" do
end
RUBY
end

it 'flags an unclear description despite extra spaces' do
expect_offense(<<-'RUBY')
it " workz " \
^^^^^^^^^^^^^^ Your test should be more descriptive.
"with #{object}" do
end
RUBY
end

it 'flags an unclear description despite uppercase and lowercase strings' do
expect_offense(<<-'RUBY')
it "WOrKz " \
^^^^^^^^^ Your test should be more descriptive.
"with #{object}" do
end
RUBY
end
end
end

0 comments on commit 0cbe7ad

Please sign in to comment.