Skip to content

Commit

Permalink
Correct some example descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
koic committed May 5, 2024
1 parent 3e9d1bc commit eab7722
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
24 changes: 12 additions & 12 deletions spec/rubocop/cop/performance/delete_prefix_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,25 +92,25 @@
context 'when `SafeMultiline: true`' do
let(:safe_multiline) { true }

it 'does not register an offense and corrects when using `gsub`' do
it 'does not register an offense when using `gsub`' do
expect_no_offenses(<<~RUBY)
str.gsub(/^prefix/, '')
RUBY
end

it 'does not register an offense and corrects when using `gsub!`' do
it 'does not register an offense when using `gsub!`' do
expect_no_offenses(<<~RUBY)
str.gsub!(/^prefix/, '')
RUBY
end

it 'does not register an offense and corrects when using `sub`' do
it 'does not register an offense when using `sub`' do
expect_no_offenses(<<~RUBY)
str.sub(/^prefix/, '')
RUBY
end

it 'does not register an offense and corrects when using `sub!`' do
it 'does not register an offense when using `sub!`' do
expect_no_offenses(<<~RUBY)
str.sub!(/^prefix/, '')
RUBY
Expand Down Expand Up @@ -193,51 +193,51 @@
end

context 'with starting pattern `\A` and ending pattern `\z`' do
it 'does not register an offense and corrects when using `gsub`' do
it 'does not register an offense when using `gsub`' do
expect_no_offenses(<<~RUBY)
str.gsub(/\\Aprefix\\z/, '')
RUBY
end

it 'does not register an offense and corrects when using `gsub!`' do
it 'does not register an offense when using `gsub!`' do
expect_no_offenses(<<~RUBY)
str.gsub!(/\\Aprefix\\z/, '')
RUBY
end

it 'does not register an offense and corrects when using `sub`' do
it 'does not register an offense when using `sub`' do
expect_no_offenses(<<~RUBY)
str.sub(/\\Aprefix\\z/, '')
RUBY
end

it 'does not register an offense and corrects when using `sub!`' do
it 'does not register an offense when using `sub!`' do
expect_no_offenses(<<~RUBY)
str.sub!(/\\Aprefix\\z/, '')
RUBY
end
end

context 'when using a non-blank string as replacement string' do
it 'does not register an offense and corrects when using `gsub`' do
it 'does not register an offense when using `gsub`' do
expect_no_offenses(<<~RUBY)
str.gsub(/\\Aprefix/, 'foo')
RUBY
end

it 'does not register an offense and corrects when using `gsub!`' do
it 'does not register an offense when using `gsub!`' do
expect_no_offenses(<<~RUBY)
str.gsub!(/\\Aprefix/, 'foo')
RUBY
end

it 'does not register an offense and corrects when using `sub`' do
it 'does not register an offense when using `sub`' do
expect_no_offenses(<<~RUBY)
str.sub(/\\Aprefix/, 'foo')
RUBY
end

it 'does not register an offense and corrects when using `sub!`' do
it 'does not register an offense when using `sub!`' do
expect_no_offenses(<<~RUBY)
str.sub!(/\\Aprefix/, 'foo')
RUBY
Expand Down
24 changes: 12 additions & 12 deletions spec/rubocop/cop/performance/delete_suffix_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,25 +92,25 @@
context 'when `SafeMultiline: true`' do
let(:safe_multiline) { true }

it 'does not register an offense and corrects when using `gsub`' do
it 'does not register an offense when using `gsub`' do
expect_no_offenses(<<~RUBY)
str.gsub(/suffix$/, '')
RUBY
end

it 'does not register an offense and corrects when using `gsub!`' do
it 'does not register an offense when using `gsub!`' do
expect_no_offenses(<<~RUBY)
str.gsub!(/suffix$/, '')
RUBY
end

it 'does not register an offense and corrects when using `sub`' do
it 'does not register an offense when using `sub`' do
expect_no_offenses(<<~RUBY)
str.sub(/suffix$/, '')
RUBY
end

it 'does not register an offense and corrects when using `sub!`' do
it 'does not register an offense when using `sub!`' do
expect_no_offenses(<<~RUBY)
str.sub!(/suffix$/, '')
RUBY
Expand Down Expand Up @@ -193,51 +193,51 @@
end

context 'with starting pattern `\A` and ending pattern `\z`' do
it 'does not register an offense and corrects when using `gsub`' do
it 'does not register an offense when using `gsub`' do
expect_no_offenses(<<~RUBY)
str.gsub(/\\Asuffix\\z/, '')
RUBY
end

it 'does not register an offense and corrects when using `gsub!`' do
it 'does not register an offense when using `gsub!`' do
expect_no_offenses(<<~RUBY)
str.gsub!(/\\Asuffix\\z/, '')
RUBY
end

it 'does not register an offense and corrects when using `sub`' do
it 'does not register an offense when using `sub`' do
expect_no_offenses(<<~RUBY)
str.sub(/\\Asuffix\\z/, '')
RUBY
end

it 'does not register an offense and corrects when using `sub!`' do
it 'does not register an offense when using `sub!`' do
expect_no_offenses(<<~RUBY)
str.sub!(/\\Asuffix\\z/, '')
RUBY
end
end

context 'when using a non-blank string as replacement string' do
it 'does not register an offense and corrects when using `gsub`' do
it 'does not register an offense when using `gsub`' do
expect_no_offenses(<<~RUBY)
str.gsub(/suffix\\z/, 'foo')
RUBY
end

it 'does not register an offense and corrects when using `gsub!`' do
it 'does not register an offense when using `gsub!`' do
expect_no_offenses(<<~RUBY)
str.gsub!(/suffix\\z/, 'foo')
RUBY
end

it 'does not register an offense and corrects when using `sub`' do
it 'does not register an offense when using `sub`' do
expect_no_offenses(<<~RUBY)
str.sub(/suffix\\z/, 'foo')
RUBY
end

it 'does not register an offense and corrects when using `sub!`' do
it 'does not register an offense when using `sub!`' do
expect_no_offenses(<<~RUBY)
str.sub!(/suffix\\z/, 'foo')
RUBY
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/performance/unfreeze_string_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

RSpec.describe RuboCop::Cop::Performance::UnfreezeString, :config do
context 'when Ruby >= 3.3', :ruby33 do
it 'does not register an offense and corrects for an empty string with `.dup`' do
it 'does not register an offense for an empty string with `.dup`' do
expect_no_offenses(<<~RUBY)
"".dup
RUBY
Expand Down

0 comments on commit eab7722

Please sign in to comment.