Skip to content

Commit

Permalink
Fix misleading spec
Browse files Browse the repository at this point in the history
Our users can only configure the 'Regex' key as a String object, not as
a Regexp instance.
  • Loading branch information
bquorning committed Apr 12, 2024
1 parent c6e0d4b commit b9919ac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions spec/rubocop/cop/naming/file_name_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ module Foo
end

context 'when Regex is set' do
let(:cop_config) { { 'Regex' => /\A[aeiou]\z/i } }
let(:cop_config) { { 'Regex' => '\A[aeiou]\z' } }

context 'with a matching name' do
it 'does not register an offense' do
Expand All @@ -406,7 +406,7 @@ module Foo
it 'registers an offense' do
expect_offense(<<~RUBY, 'z.rb')
print 1
^{} `z.rb` should match `(?i-mx:\\A[aeiou]\\z)`.
^{} `z.rb` should match `\\A[aeiou]\\z`.
RUBY
end
end
Expand Down

0 comments on commit b9919ac

Please sign in to comment.