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 7f9595a commit 49c6e92
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 29 deletions.
4 changes: 2 additions & 2 deletions spec/rubocop/cop/layout/empty_line_after_guard_clause_spec.rb
Expand Up @@ -484,7 +484,7 @@ def foo
RUBY
end

it 'does not register an offense and corrects when using `return` before guard condition with heredoc' do
it 'does not register an offense when using `return` before guard condition with heredoc' do
expect_no_offenses(<<~RUBY)
def foo
return true if <<~TEXT.length > bar
Expand All @@ -496,7 +496,7 @@ def foo
RUBY
end

it 'does not register an offense and corrects when using `raise` before guard condition with heredoc' do
it 'does not register an offense when using `raise` before guard condition with heredoc' do
expect_no_offenses(<<~RUBY)
def foo
raise if <<~TEXT.length > bar
Expand Down
Expand Up @@ -220,7 +220,7 @@ class Foo
RUBY
end

it 'does not register an offense and corrects when using `if` ... `else` branches' do
it 'does not register an offense when using `if` ... `else` branches' do
expect_no_offenses(<<~RUBY)
if condition
attr_reader :foo
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/layout/hash_alignment_spec.rb
Expand Up @@ -1361,7 +1361,7 @@ def self.scenarios_order

context 'when using hash value omission', :ruby31 do
context 'and aligned keys' do
it 'does not register an offense and corrects' do
it 'does not register an offense' do
expect_no_offenses(<<~RUBY)
foo ab: 1,
c:
Expand Down
8 changes: 4 additions & 4 deletions spec/rubocop/cop/lint/redundant_dir_glob_sort_spec.rb
Expand Up @@ -87,26 +87,26 @@
end

context 'when Ruby 2.7 or lower', :ruby27, unsupported_on: :prism do
it 'does not register an offense and correction when using `Dir.glob.sort`' do
it 'does not register an offense when using `Dir.glob.sort`' do
expect_no_offenses(<<~RUBY)
Dir.glob(Rails.root.join('test', '*.rb')).sort.each(&method(:require))
RUBY
end

it 'does not register an offense and correction when using `::Dir.glob.sort`' do
it 'does not register an offense when using `::Dir.glob.sort`' do
expect_no_offenses(<<~RUBY)
::Dir.glob(Rails.root.join('test', '*.rb')).sort.each(&method(:require))
RUBY
end

it 'does not register an offense and correction when using `Dir[].sort.each do`' do
it 'does not register an offense when using `Dir[].sort.each do`' do
expect_no_offenses(<<~RUBY)
Dir['./lib/**/*.rb'].sort.each do |file|
end
RUBY
end

it 'does not register an offense and correction when using `Dir[].sort.each(&do_something)`' do
it 'does not register an offense when using `Dir[].sort.each(&do_something)`' do
expect_no_offenses(<<~RUBY)
Dir['./lib/**/*.rb'].sort.each(&method(:require))
RUBY
Expand Down
16 changes: 8 additions & 8 deletions spec/rubocop/cop/lint/redundant_require_statement_spec.rb
Expand Up @@ -128,55 +128,55 @@
end

context 'when requiring `pp`' do
it 'does not register an offense and corrects when using `PP.pp`' do
it 'does not register an offense when using `PP.pp`' do
expect_no_offenses(<<~RUBY)
require 'pp'
PP.pp
RUBY
end

it 'does not register an offense and corrects when using `::PP.pp`' do
it 'does not register an offense when using `::PP.pp`' do
expect_no_offenses(<<~RUBY)
require 'pp'
::PP.pp
RUBY
end

it 'does not register an offense and corrects when using `pretty_inspect`' do
it 'does not register an offense when using `pretty_inspect`' do
expect_no_offenses(<<~RUBY)
require 'pp'
foo.pretty_inspect
RUBY
end

it 'does not register an offense and corrects when using `pretty_print`' do
it 'does not register an offense when using `pretty_print`' do
expect_no_offenses(<<~RUBY)
require 'pp'
foo.pretty_print(pp_instance)
RUBY
end

it 'does not register an offense and corrects when using `pretty_print_cycle`' do
it 'does not register an offense when using `pretty_print_cycle`' do
expect_no_offenses(<<~RUBY)
require 'pp'
foo.pretty_print_cycle(pp_instance)
RUBY
end

it 'does not register an offense and corrects when using `pretty_print_inspect`' do
it 'does not register an offense when using `pretty_print_inspect`' do
expect_no_offenses(<<~RUBY)
require 'pp'
foo.pretty_print_inspect
RUBY
end

it 'does not register an offense and corrects when using `pretty_print_instance_variables`' do
it 'does not register an offense when using `pretty_print_instance_variables`' do
expect_no_offenses(<<~RUBY)
require 'pp'
Expand Down Expand Up @@ -219,7 +219,7 @@
end

context 'target ruby version < 3.1', :ruby30, unsupported_on: :prism do
it 'does not register an offense and corrects when using requiring `fiber`' do
it 'does not register an offense when using requiring `fiber`' do
expect_no_offenses(<<~RUBY)
require 'fiber'
RUBY
Expand Down
4 changes: 2 additions & 2 deletions spec/rubocop/cop/lint/redundant_safe_navigation_spec.rb
Expand Up @@ -20,7 +20,7 @@
RUBY
end

it 'does not register an offense and corrects when `&.` is used for snake case const receiver' do
it 'does not register an offense when `&.` is used for snake case const receiver' do
expect_no_offenses(<<~RUBY)
CONST&.do_something
CONST_NAME&.do_something
Expand Down Expand Up @@ -102,7 +102,7 @@
RUBY
end

it 'does not register an offense and corrects when `&.` is used for `nil` literal' do
it 'does not register an offense when `&.` is used for `nil` literal' do
expect_no_offenses(<<~RUBY)
nil&.to_i
RUBY
Expand Down
4 changes: 2 additions & 2 deletions spec/rubocop/cop/security/yaml_load_spec.rb
Expand Up @@ -40,13 +40,13 @@
# Ruby 3.1+ (Psych 4) uses `Psych.load` as `Psych.safe_load` by default.
# https://github.com/ruby/psych/pull/487
context 'Ruby >= 3.1', :ruby31 do
it 'does not register an offense and corrects load with a literal string' do
it 'does not register an offense load with a literal string' do
expect_no_offenses(<<~RUBY)
YAML.load("--- !ruby/object:Foo {}", permitted_classes: [Foo])
RUBY
end

it 'does not register an offense and corrects a fully qualified `::YAML.load`' do
it 'does not register an offense a fully qualified `::YAML.load`' do
expect_no_offenses(<<~RUBY)
::YAML.load("--- !ruby/object:Foo {}", permitted_classes: [Foo])
RUBY
Expand Down
14 changes: 7 additions & 7 deletions spec/rubocop/cop/style/collection_compact_spec.rb
Expand Up @@ -179,7 +179,7 @@ def foo(params)
RUBY
end

it 'does not register an offense and corrects when using `grep_v(pattern)`' do
it 'does not register an offense when using `grep_v(pattern)`' do
expect_no_offenses(<<~RUBY)
array.grep_v(pattern)
RUBY
Expand All @@ -200,15 +200,15 @@ def foo(params)
end

context 'when without receiver' do
it 'does not register an offense and corrects when using `reject` on array to reject nils' do
it 'does not register an offense when using `reject` on array to reject nils' do
expect_no_offenses(<<~RUBY)
reject { |e| e.nil? }
delete_if { |e| e.nil? }
reject! { |e| e.nil? }
RUBY
end

it 'does not register an offense and corrects when using `select/select!` to reject nils' do
it 'does not register an offense when using `select/select!` to reject nils' do
expect_no_offenses(<<~RUBY)
select { |e| !e.nil? }
select! { |k, v| !v.nil? }
Expand All @@ -231,7 +231,7 @@ def foo(params)
RUBY
end

it 'does not register an offense and corrects when using `to_enum.delete_if` on array to reject nils' do
it 'does not register an offense when using `to_enum.delete_if` on array to reject nils' do
expect_no_offenses(<<~RUBY)
array.to_enum.delete_if { |e| e.nil? }
RUBY
Expand All @@ -251,23 +251,23 @@ def foo(params)
RUBY
end

it 'does not register an offense and corrects when using `lazy.delete_if` on array to reject nils' do
it 'does not register an offense when using `lazy.delete_if` on array to reject nils' do
expect_no_offenses(<<~RUBY)
array.lazy.delete_if { |e| e.nil? }
RUBY
end
end

context 'Ruby <= 3.0', :ruby30, unsupported_on: :prism do
it 'does not register an offense and corrects when using `to_enum.reject` on array to reject nils' do
it 'does not register an offense when using `to_enum.reject` on array to reject nils' do
expect_no_offenses(<<~RUBY)
array.to_enum.reject { |e| e.nil? }
array.to_enum.delete_if { |e| e.nil? }
array.to_enum.reject! { |e| e.nil? }
RUBY
end

it 'does not register an offense and corrects when using `lazy.reject` on array to reject nils' do
it 'does not register an offense when using `lazy.reject` on array to reject nils' do
expect_no_offenses(<<~RUBY)
array.lazy.reject { |e| e.nil? }
array.lazy.delete_if { |e| e.nil? }
Expand Down
Expand Up @@ -240,7 +240,7 @@
end

context 'with a character class containing multiple unicode code-points' do
it 'does not register an offense and corrects' do
it 'does not register an offense' do
expect_no_offenses(<<~'RUBY')
foo = /[\u{0061 0062}]/
RUBY
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/style/single_argument_dig_spec.rb
Expand Up @@ -14,7 +14,7 @@
RUBY
end

it 'does not register an offense and corrects unsuitable use of dig with safe navigation operator' do
it 'does not register an offense unsuitable use of dig with safe navigation operator' do
expect_no_offenses(<<~RUBY)
{ key: 'value' }&.dig(:key)
RUBY
Expand Down

0 comments on commit 49c6e92

Please sign in to comment.