Skip to content

Commit

Permalink
Fix InternalAffairs/ExampleDescription offenses.
Browse files Browse the repository at this point in the history
  • Loading branch information
dvandersluis authored and bbatsov committed Jan 27, 2021
1 parent c37b550 commit 9a06e84
Show file tree
Hide file tree
Showing 28 changed files with 61 additions and 61 deletions.
6 changes: 3 additions & 3 deletions spec/rubocop/cop/gemspec/duplicated_assignment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
RUBY
end

it 'registers an offense when using `<<` twice' do
it 'does not register an offense when using `<<` twice' do
expect_no_offenses(<<~RUBY)
Gem::Specification.new do |spec|
spec.requirements << 'libmagick, v6.0'
Expand All @@ -42,7 +42,7 @@
RUBY
end

it 'registers an offense when using `spec.add_dependency` twice' do
it 'does not register an offense when using `spec.add_dependency` twice' do
expect_no_offenses(<<~RUBY)
Gem::Specification.new do |spec|
spec.add_runtime_dependency('parallel', '~> 1.10')
Expand All @@ -51,7 +51,7 @@
RUBY
end

it 'registers an offense when `name=` method call is not block value' do
it 'does not register an offense when `name=` method call is not block value' do
expect_no_offenses(<<~RUBY)
Gem::Specification.new do |spec|
foo = Foo.new
Expand Down
8 changes: 4 additions & 4 deletions spec/rubocop/cop/layout/array_alignment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
RUBY
end

it 'does not auto-correct array within array with too much indentation' do
it 'auto-corrects array within array with too much indentation' do
expect_offense(<<~RUBY)
[:l1,
[:l2,
Expand All @@ -80,7 +80,7 @@
RUBY
end

it 'does not auto-correct array within array with too little indentation' do
it 'auto-corrects array within array with too little indentation' do
expect_offense(<<~RUBY)
[:l1,
[:l2,
Expand Down Expand Up @@ -228,7 +228,7 @@
RUBY
end

it 'does not auto-correct array within array with too much indentation' do
it 'auto-corrects array within array with too much indentation' do
expect_offense(<<~RUBY)
[:l1,
[:l2,
Expand All @@ -246,7 +246,7 @@
RUBY
end

it 'does not auto-correct array within array with too little indentation' do
it 'auto-corrects array within array with too little indentation' do
expect_offense(<<~RUBY)
[:l1,
[:l2,
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/layout/case_indentation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@
context 'when case is preceded by something else than whitespace' do
let(:cop_config) { {} }

it 'registers an offense and does not correct' do
it 'registers an offense and auto-corrects' do
expect_offense(<<~RUBY)
case test when something
^^^^ Indent `when` as deep as `case`.
Expand Down
4 changes: 2 additions & 2 deletions spec/rubocop/cop/layout/empty_line_after_guard_clause_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def foo
RUBY
end

it 'accepta a guard clause after a single line heredoc' do
it 'accepts a guard clause after a single line heredoc' do
expect_no_offenses(<<~RUBY)
def foo
raise ArgumentError, <<-MSG unless path
Expand All @@ -373,7 +373,7 @@ def foo
RUBY
end

it 'accepta a guard clause that is after multiline heredoc' do
it 'accepts a guard clause that is after multiline heredoc' do
expect_no_offenses(<<~RUBY)
def foo
raise ArgumentError, <<-MSG unless path
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/layout/empty_line_between_defs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ def bar() = y
context 'with AllowAdjacentOneLineDefs: true' do
let(:cop_config) { { 'AllowAdjacentOneLineDefs' => true } }

it ' does not register an offense' do
it 'does not register an offense' do
expect_no_offenses(<<~RUBY)
def foo() = x
def bar() = y
Expand Down
18 changes: 10 additions & 8 deletions spec/rubocop/cop/layout/extra_spacing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -330,16 +330,18 @@ class A < String
context 'being false' do
sources.each do |reason, src|
context "such as #{reason}" do
it 'registers offense(s)' do
# In these specific test cases, the extra space in question
# is to align comments, so it would be allowed by EITHER ONE
# being true. Yes, that means technically it interferes a bit,
# but specifically in the way it was intended to.
if ['aligning tokens with empty line between',
'aligning trailing comments'].include?(reason)
# In these specific test cases, the extra space in question
# is to align comments, so it would be allowed by EITHER ONE
# being true. Yes, that means technically it interferes a bit,
# but specifically in the way it was intended to.
if ['aligning tokens with empty line between',
'aligning trailing comments'].include?(reason)
it 'does not register an offense' do
src_without_annotations = src.gsub(/^ +\^.+\n/, '')
expect_no_offenses(src_without_annotations)
else
end
else
it 'registers offense(s)' do
expect_offense(src)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/layout/indentation_consistency_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ def priv
RUBY
end

it 'does not auto-correct an offense within another offense' do
it 'does not auto-correct an offense within another offense' do # rubocop:disable InternalAffairs/ExampleDescription
expect_offense(<<~RUBY)
require 'spec_helper'
describe ArticlesController do
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/layout/line_length_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
}
end

it 'accepts long lines matching a pattern but not other long lines' do
it 'only registers an offense for lines not matching the pattern' do
expect_offense(<<~RUBY)
class ExampleTest < TestCase
^^^^^^^^^^ Line is too long. [28/18]
Expand Down
3 changes: 1 addition & 2 deletions spec/rubocop/cop/layout/multiline_block_layout_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,7 @@ def f
RUBY
end

it 'does not auto-correct a trailing comma when only one argument ' \
'is present' do
it 'does not remove a trailing comma when only one argument is present' do
expect_offense(<<~RUBY)
def f
X.map do |
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/lint/debugger_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
RUBY
end

it 'does not report an offense for save_and_open_page with Kernel' do
it 'reports an offense for save_and_open_page with Kernel' do
expect_offense(<<~RUBY)
Kernel.save_and_open_page
^^^^^^^^^^^^^^^^^^^^^^^^^ Remove debugger entry point `Kernel.save_and_open_page`.
Expand Down
3 changes: 2 additions & 1 deletion spec/rubocop/cop/lint/duplicate_methods_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,15 @@ def self.some_method
RUBY
end

it 'registers offense for a duplicate instance method in separate files' do
it 'only registers an offense for the second instance of a duplicate instance method in separate files' do
expect_no_offenses(<<~RUBY, 'first.rb')
#{opening_line}
def some_method
implement 1
end
end
RUBY

expect_offense(<<~RUBY, 'second.rb')
#{opening_line}
def some_method
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
end

context 'with no repeated character class elements' do
it 'registers an offense and corrects' do
it 'does not register an offense' do
expect_no_offenses(<<~RUBY)
foo = /[xyz]/
RUBY
end
end

context 'with repeated elements in different character classes' do
it 'registers an offense and corrects' do
it 'does not register an offense' do
expect_no_offenses(<<~RUBY)
foo = /[xyz][xyz]/
RUBY
Expand Down
4 changes: 2 additions & 2 deletions spec/rubocop/cop/lint/format_parameter_mismatch_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@
RUBY
end

it 'registers an offense for `#format`' do
it 'does not registes an offense for `#format`' do
expect_no_offenses(<<~RUBY)
puts format("%s, %s, %s", 1, 2, 3, 4, *arr)
RUBY
end

it 'registers an offense for `#sprintf`' do
it 'does not register an offense for `#sprintf`' do
expect_no_offenses(<<~RUBY)
puts sprintf("%s, %s, %s", 1, 2, 3, 4, *arr)
RUBY
Expand Down
4 changes: 1 addition & 3 deletions spec/rubocop/cop/lint/safe_navigation_consistency_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@
^^^^^^^^^^^^^^^^^^^^^ Ensure that safe navigation is used consistently inside of `&&` and `||`.
RUBY

expect_correction(<<~RUBY)
foo&.zero? || foo > 5
RUBY
expect_no_corrections
end

it 'registers an offense and corrects assignment' do
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/lint/shadowed_exception_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def foo
RUBY
end

it 'registers an offense for splat arguments rescued after ' \
it 'does not register an offense for splat arguments rescued after ' \
'rescuing a known exception' do
expect_no_offenses(<<~RUBY)
begin
Expand Down
20 changes: 10 additions & 10 deletions spec/rubocop/cop/lint/top_level_return_with_argument_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

RSpec.describe RuboCop::Cop::Lint::TopLevelReturnWithArgument, :config do
context 'Code segment with only top-level return statement' do
it 'Expects no offense from the return without arguments' do
it 'expects no offense from the return without arguments' do
expect_no_offenses(<<~RUBY)
return
RUBY
end

it 'Expects offense from the return with arguments' do
it 'expects offense from the return with arguments' do
expect_offense(<<~RUBY)
return 1, 2, 3
^^^^^^^^^^^^^^ Top level return with argument detected.
RUBY
end

it 'Expects multiple offenses from the return with arguments statements' do
it 'expects multiple offenses from the return with arguments statements' do
expect_offense(<<~RUBY)
return 1, 2, 3
^^^^^^^^^^^^^^ Top level return with argument detected.
Expand All @@ -30,7 +30,7 @@
end

context 'Code segment with block level returns other than the top-level return' do
it 'Expects no offense from the return without arguments' do
it 'expects no offense from the return without arguments' do
expect_no_offenses(<<~RUBY)
foo
Expand All @@ -42,7 +42,7 @@
RUBY
end

it 'Expects offense from the return with arguments' do
it 'expects offense from the return with arguments' do
expect_offense(<<~RUBY)
foo
Expand All @@ -57,7 +57,7 @@
end

context 'Code segment with method-level return statements' do
it 'Expects offense when method-level & top-level return co-exist' do
it 'expects offense when method-level & top-level return co-exist' do
expect_offense(<<~RUBY)
def method
return 'Hello World'
Expand All @@ -70,7 +70,7 @@ def method
end

context 'Code segment with inline if along with top-level return' do
it 'Expects no offense from the return without arguments' do
it 'expects no offense from the return without arguments' do
expect_no_offenses(<<~RUBY)
foo
Expand All @@ -84,7 +84,7 @@ def method
RUBY
end

it 'Expects multiple offense from the return with arguments' do
it 'expects multiple offense from the return with arguments' do
expect_offense(<<~RUBY)
foo
return 1, 2, 3 if 1 == 1
Expand All @@ -103,7 +103,7 @@ def method
end

context 'Code segment containing semi-colon separated statements' do
it 'Expects an offense from the return with arguments and multi-line code' do
it 'expects an offense from the return with arguments and multi-line code' do
expect_offense(<<~RUBY)
foo
Expand All @@ -114,7 +114,7 @@ def method
RUBY
end

it 'Expects no offense from the return with arguments and multi-line code' do
it 'expects no offense from the return with arguments and multi-line code' do
expect_no_offenses(<<~RUBY)
foo
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/lint/useless_access_modifier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ def method1
end

shared_examples 'method named by access modifier name' do |keyword, modifier|
it "registers an offense for `#{modifier}`" do
it "does not register an offense for `#{modifier}`" do
expect_no_offenses(<<~RUBY)
#{keyword} A
def foo
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/metrics/class_length_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class Test
end

context 'when overlapping constant assignments' do
it 'registers an offense' do
it 'does not register an offense' do
expect_no_offenses(<<~RUBY)
X = Y = Z = do_something
RUBY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def main
RUBY
end

it 'does not correct other variables or assignments' do
it 'only corrects the exception variable' do
expect_offense(<<~RUBY)
def main
raise
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@
RUBY
end

it 'registers an offense when multiple assignment is in else' do
it 'does not register an offense when multiple assignment is in else' do
expect_no_offenses(<<~RUBY)
if foo
method_call
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/style/double_negation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
end

shared_examples 'common' do
it 'does not register an offense and corrects for `!!` when not a return location' do
it 'registers an offense and corrects for `!!` when not a return location' do
expect_offense(<<~RUBY)
def foo?
foo
Expand Down
6 changes: 3 additions & 3 deletions spec/rubocop/cop/style/endless_method_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,23 +114,23 @@ def my_method(a, b) = x
RUBY
end

it 'registers an offense and corrects for a multiline endless method' do
it 'does not register an offense for a multiline endless method' do
expect_no_offenses(<<~RUBY)
def my_method() = x.foo
.bar
.baz
RUBY
end

it 'registers an offense and corrects for a multiline endless method with begin' do
it 'does not register an offense for a multiline endless method with begin' do
expect_no_offenses(<<~RUBY)
def my_method() = begin
foo && bar
end
RUBY
end

it 'registers an offense and corrects for a multiline endless method with arguments' do
it 'does not register an offense for a multiline endless method with arguments' do
expect_no_offenses(<<~RUBY)
def my_method(a, b) = x.foo
.bar
Expand Down
Loading

0 comments on commit 9a06e84

Please sign in to comment.