From adbc170467796fbc6927e27fb3bd24cf8c5c6237 Mon Sep 17 00:00:00 2001 From: Benjamin Quorning Date: Thu, 13 Oct 2022 21:59:44 +0200 Subject: [PATCH 1/3] Enable Layout/LineContinuationSpacing ...and fix offenses. --- .rubocop.yml | 5 +++++ .../rubocop/cop/rspec/empty_line_after_example_group_spec.rb | 2 +- spec/rubocop/cop/rspec/empty_line_after_example_spec.rb | 2 +- spec/rubocop/cop/rspec/empty_line_after_final_let_spec.rb | 4 ++-- spec/rubocop/cop/rspec/empty_line_after_hook_spec.rb | 2 +- spec/rubocop/cop/rspec/empty_line_after_subject_spec.rb | 2 +- spec/rubocop/cop/rspec/file_path_spec.rb | 4 ++-- 7 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 6923ff274..678c213cf 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -95,6 +95,11 @@ Style/FormatStringToken: Exclude: - spec/rubocop/**/*.rb +# Enable some of RuboCop's pending cops. + +Layout/LineContinuationSpacing: + Enabled: true + # Enable our own pending cops. RSpec/BeEq: diff --git a/spec/rubocop/cop/rspec/empty_line_after_example_group_spec.rb b/spec/rubocop/cop/rspec/empty_line_after_example_group_spec.rb index a88a44d6e..e110c790b 100644 --- a/spec/rubocop/cop/rspec/empty_line_after_example_group_spec.rb +++ b/spec/rubocop/cop/rspec/empty_line_after_example_group_spec.rb @@ -232,7 +232,7 @@ RUBY end - it 'flags a missing empty line after a `rubocop:enable` directive '\ + it 'flags a missing empty line after a `rubocop:enable` directive ' \ 'when it is followed by a `rubocop:disable` directive' do expect_offense(<<-RUBY) RSpec.describe Foo do diff --git a/spec/rubocop/cop/rspec/empty_line_after_example_spec.rb b/spec/rubocop/cop/rspec/empty_line_after_example_spec.rb index 378b4ded4..0e7babaad 100644 --- a/spec/rubocop/cop/rspec/empty_line_after_example_spec.rb +++ b/spec/rubocop/cop/rspec/empty_line_after_example_spec.rb @@ -216,7 +216,7 @@ RUBY end - it 'flags a missing empty line after a `rubocop:enable` directive '\ + it 'flags a missing empty line after a `rubocop:enable` directive ' \ 'when it is followed by a `rubocop:disable` directive' do expect_offense(<<-RUBY) RSpec.describe Foo do diff --git a/spec/rubocop/cop/rspec/empty_line_after_final_let_spec.rb b/spec/rubocop/cop/rspec/empty_line_after_final_let_spec.rb index 864cb8382..810ab2a22 100644 --- a/spec/rubocop/cop/rspec/empty_line_after_final_let_spec.rb +++ b/spec/rubocop/cop/rspec/empty_line_after_final_let_spec.rb @@ -76,7 +76,7 @@ RUBY end - it 'does not register an offense for comment '\ + it 'does not register an offense for comment ' \ 'followed by an empty line after let' do expect_no_offenses(<<-RUBY) RSpec.describe User do @@ -183,7 +183,7 @@ RUBY end - it 'flags a missing empty line after a `rubocop:enable` directive '\ + it 'flags a missing empty line after a `rubocop:enable` directive ' \ 'when it is followed by a `rubocop:disable` directive' do expect_offense(<<-RUBY) RSpec.describe User do diff --git a/spec/rubocop/cop/rspec/empty_line_after_hook_spec.rb b/spec/rubocop/cop/rspec/empty_line_after_hook_spec.rb index fd4ac99e7..ff4aa72e3 100644 --- a/spec/rubocop/cop/rspec/empty_line_after_hook_spec.rb +++ b/spec/rubocop/cop/rspec/empty_line_after_hook_spec.rb @@ -253,7 +253,7 @@ RUBY end - it 'flags a missing empty line after a `rubocop:enable` directive '\ + it 'flags a missing empty line after a `rubocop:enable` directive ' \ 'when it is followed by a `rubocop:disable` directive' do expect_offense(<<-RUBY) RSpec.describe User do diff --git a/spec/rubocop/cop/rspec/empty_line_after_subject_spec.rb b/spec/rubocop/cop/rspec/empty_line_after_subject_spec.rb index 40fe48236..b2b328851 100644 --- a/spec/rubocop/cop/rspec/empty_line_after_subject_spec.rb +++ b/spec/rubocop/cop/rspec/empty_line_after_subject_spec.rb @@ -183,7 +183,7 @@ RUBY end - it 'flags a missing empty line after a `rubocop:enable` directive '\ + it 'flags a missing empty line after a `rubocop:enable` directive ' \ 'when it is followed by a `rubocop:disable` directive' do expect_offense(<<-RUBY) RSpec.describe User do diff --git a/spec/rubocop/cop/rspec/file_path_spec.rb b/spec/rubocop/cop/rspec/file_path_spec.rb index f753023ef..392e76189 100644 --- a/spec/rubocop/cop/rspec/file_path_spec.rb +++ b/spec/rubocop/cop/rspec/file_path_spec.rb @@ -91,7 +91,7 @@ RUBY end - it 'does not register an offense for example groups '\ + it 'does not register an offense for example groups ' \ 'do not describe a class / method' do expect_no_offenses(<<-RUBY, 'some/class/spec.rb') describe 'Test something' do; end @@ -198,7 +198,7 @@ RUBY end - it 'does not register an offense for an arbitrary spec name '\ + it 'does not register an offense for an arbitrary spec name ' \ 'for an operator method' do filename = 'my_little_class/spaceship_operator_spec.rb' expect_no_offenses(<<-RUBY, filename) From 45cd9bdd1136d74604d7dff3b06c5903d0903eb2 Mon Sep 17 00:00:00 2001 From: Benjamin Quorning Date: Thu, 13 Oct 2022 22:08:36 +0200 Subject: [PATCH 2/3] Enable Layout/LineEndStringConcatenationIndentation ...and fix offenses. --- .rubocop.yml | 2 ++ lib/rubocop/cop/rspec/change_by_zero.rb | 2 +- .../cop/rspec/factory_bot/create_list.rb | 4 ++-- .../cop/rspec/repeated_include_example.rb | 2 +- spec/rubocop/cli/autocorrect_spec.rb | 2 +- .../cop/rspec/before_after_all_spec.rb | 6 ++--- .../rspec/capybara/specific_finders_spec.rb | 14 ++++++------ .../rspec/capybara/specific_matcher_spec.rb | 22 +++++++++---------- spec/rubocop/cop/rspec/change_by_zero_spec.rb | 22 +++++++++---------- .../cop/rspec/empty_example_group_spec.rb | 2 +- .../empty_line_after_example_group_spec.rb | 2 +- .../rspec/empty_line_after_example_spec.rb | 2 +- .../rspec/empty_line_after_final_let_spec.rb | 2 +- .../cop/rspec/empty_line_after_hook_spec.rb | 2 +- .../rspec/empty_line_after_subject_spec.rb | 2 +- .../rspec/repeated_include_example_spec.rb | 6 ++--- 16 files changed, 48 insertions(+), 46 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 678c213cf..b43bdb782 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -99,6 +99,8 @@ Style/FormatStringToken: Layout/LineContinuationSpacing: Enabled: true +Layout/LineEndStringConcatenationIndentation: + Enabled: true # Enable our own pending cops. diff --git a/lib/rubocop/cop/rspec/change_by_zero.rb b/lib/rubocop/cop/rspec/change_by_zero.rb index 70f8c722d..4fa59ff0d 100644 --- a/lib/rubocop/cop/rspec/change_by_zero.rb +++ b/lib/rubocop/cop/rspec/change_by_zero.rb @@ -61,7 +61,7 @@ class ChangeByZero < Base extend AutoCorrector MSG = 'Prefer `not_to change` over `to change.by(0)`.' MSG_COMPOUND = 'Prefer %s with compound expectations ' \ - 'over `change.by(0)`.' + 'over `change.by(0)`.' RESTRICT_ON_SEND = %i[change].freeze # @!method expect_change_with_arguments(node) diff --git a/lib/rubocop/cop/rspec/factory_bot/create_list.rb b/lib/rubocop/cop/rspec/factory_bot/create_list.rb index 986a3e708..c3f8f3c92 100644 --- a/lib/rubocop/cop/rspec/factory_bot/create_list.rb +++ b/lib/rubocop/cop/rspec/factory_bot/create_list.rb @@ -238,8 +238,8 @@ def format_multiline_block(node) indent = ' ' * node.body.loc.column indent_end = ' ' * node.parent.loc.column " do #{node.arguments.source}\n" \ - "#{indent}#{node.body.source}\n" \ - "#{indent_end}end" + "#{indent}#{node.body.source}\n" \ + "#{indent_end}end" end def format_singleline_block(node) diff --git a/lib/rubocop/cop/rspec/repeated_include_example.rb b/lib/rubocop/cop/rspec/repeated_include_example.rb index 4e2e03a83..0205060c8 100644 --- a/lib/rubocop/cop/rspec/repeated_include_example.rb +++ b/lib/rubocop/cop/rspec/repeated_include_example.rb @@ -47,7 +47,7 @@ module RSpec # class RepeatedIncludeExample < Base MSG = 'Repeated include of shared_examples %s ' \ - 'on line(s) %s' + 'on line(s) %s' # @!method several_include_examples?(node) def_node_matcher :several_include_examples?, <<-PATTERN diff --git a/spec/rubocop/cli/autocorrect_spec.rb b/spec/rubocop/cli/autocorrect_spec.rb index 6740c23f8..fce3b57d9 100644 --- a/spec/rubocop/cli/autocorrect_spec.rb +++ b/spec/rubocop/cli/autocorrect_spec.rb @@ -8,7 +8,7 @@ include_context 'when cli spec behavior' context 'when corrects `RSpec/Capybara/CurrentPathExpectation` with ' \ - '`Style/TrailingCommaInArguments`' do + '`Style/TrailingCommaInArguments`' do before do RuboCop::ConfigLoader .default_configuration diff --git a/spec/rubocop/cop/rspec/before_after_all_spec.rb b/spec/rubocop/cop/rspec/before_after_all_spec.rb index 31c2d5cfe..ea835b0fa 100644 --- a/spec/rubocop/cop/rspec/before_after_all_spec.rb +++ b/spec/rubocop/cop/rspec/before_after_all_spec.rb @@ -3,9 +3,9 @@ RSpec.describe RuboCop::Cop::RSpec::BeforeAfterAll do def message(hook) "Beware of using `#{hook}` as it may cause state to leak between tests. " \ - 'If you are using `rspec-rails`, and `use_transactional_fixtures` is ' \ - "enabled, then records created in `#{hook}` are not automatically rolled " \ - 'back.' + 'If you are using `rspec-rails`, and `use_transactional_fixtures` is ' \ + "enabled, then records created in `#{hook}` are not automatically " \ + 'rolled back.' end context 'when using before all' do diff --git a/spec/rubocop/cop/rspec/capybara/specific_finders_spec.rb b/spec/rubocop/cop/rspec/capybara/specific_finders_spec.rb index 5996f06e9..fc2bda62a 100644 --- a/spec/rubocop/cop/rspec/capybara/specific_finders_spec.rb +++ b/spec/rubocop/cop/rspec/capybara/specific_finders_spec.rb @@ -35,7 +35,7 @@ end it 'registers an offense when using `find` and other args ' \ - 'with no parentheses' do + 'with no parentheses' do expect_offense(<<~RUBY) find '#some-id', exact_text: 'foo' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `find_by` over `find`. @@ -60,7 +60,7 @@ end it 'registers an offense when using `find ' \ - 'with argument is attribute specified id' do + 'with argument is attribute specified id' do expect_offense(<<~RUBY) find('[id=some-id]') ^^^^^^^^^^^^^^^^^^^^ Prefer `find_by` over `find`. @@ -78,7 +78,7 @@ end it 'does not register an offense when using `find ' \ - 'with argument is attribute not specified id' do + 'with argument is attribute not specified id' do expect_no_offenses(<<~RUBY) find('[visible]') find('[class=some-cls][visible]') @@ -86,21 +86,21 @@ end it 'does not register an offense when using `find ' \ - 'with argument is element with id' do + 'with argument is element with id' do expect_no_offenses(<<~RUBY) find('h1#some-id') RUBY end it 'does not register an offense when using `find ' \ - 'with argument is element with attribute specified id' do + 'with argument is element with attribute specified id' do expect_no_offenses(<<~RUBY) find('h1[id=some-id]') RUBY end it 'does not register an offense when using `find` ' \ - 'with argument is not id' do + 'with argument is not id' do expect_no_offenses(<<~RUBY) find('a.some-id') find('.some-id') @@ -114,7 +114,7 @@ end it 'does not register an offense when using `find` ' \ - 'with argument is id with multiple matcher' do + 'with argument is id with multiple matcher' do expect_no_offenses(<<~RUBY) find('#some-id body') find('#some-id>h1') diff --git a/spec/rubocop/cop/rspec/capybara/specific_matcher_spec.rb b/spec/rubocop/cop/rspec/capybara/specific_matcher_spec.rb index 868bb7894..0a605cdd4 100644 --- a/spec/rubocop/cop/rspec/capybara/specific_matcher_spec.rb +++ b/spec/rubocop/cop/rspec/capybara/specific_matcher_spec.rb @@ -2,7 +2,7 @@ RSpec.describe RuboCop::Cop::RSpec::Capybara::SpecificMatcher do it 'does not register an offense for abstract matcher when ' \ - 'first argument is not a replaceable element' do + 'first argument is not a replaceable element' do expect_no_offenses(<<-RUBY) expect(page).to have_selector('article') expect(page).to have_no_selector('body') @@ -11,7 +11,7 @@ end it 'does not register an offense for abstract matcher when ' \ - 'first argument is not an element' do + 'first argument is not an element' do expect_no_offenses(<<-RUBY) expect(page).to have_no_css('.a') expect(page).to have_selector('#button') @@ -206,7 +206,7 @@ class style visible obscured exact exact_text normalize_ws match wait end it 'registers an offense when using abstract matcher with ' \ - 'first argument is element with replaceable pseudo-classes' do + 'first argument is element with replaceable pseudo-classes' do expect_offense(<<-RUBY) expect(page).to have_css('button:not([disabled])', exact_text: 'bar') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `have_button` over `have_css`. @@ -216,7 +216,7 @@ class style visible obscured exact exact_text normalize_ws match wait end it 'registers an offense when using abstract matcher with ' \ - 'first argument is element with multiple replaceable pseudo-classes' do + 'first argument is element with multiple replaceable pseudo-classes' do expect_offense(<<-RUBY) expect(page).to have_css('button:not([disabled]):enabled') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `have_button` over `have_css`. @@ -234,22 +234,22 @@ class style visible obscured exact exact_text normalize_ws match wait end it 'does not register an offense when using abstract matcher with ' \ - 'first argument is element with replaceable pseudo-classes' \ - 'and not boolean attributes' do + 'first argument is element with replaceable pseudo-classes' \ + 'and not boolean attributes' do expect_no_offenses(<<-RUBY) expect(page).to have_css('button:not([name="foo"][disabled])') RUBY end it 'does not register an offense when using abstract matcher with ' \ - 'first argument is element with multiple nonreplaceable pseudo-classes' do + 'first argument is element with multiple nonreplaceable pseudo-classes' do expect_no_offenses(<<-RUBY) expect(page).to have_css('button:first-of-type:not([disabled])') RUBY end it 'does not register an offense for abstract matcher when ' \ - 'first argument is element with nonreplaceable attributes' do + 'first argument is element with nonreplaceable attributes' do expect_no_offenses(<<-RUBY) expect(page).to have_css('button[data-disabled]') expect(page).to have_css('button[foo=bar]') @@ -258,7 +258,7 @@ class style visible obscured exact exact_text normalize_ws match wait end it 'does not register an offense for abstract matcher when ' \ - 'first argument is element with multiple nonreplaceable attributes' do + 'first argument is element with multiple nonreplaceable attributes' do expect_no_offenses(<<-RUBY) expect(page).to have_css('button[disabled][foo]') expect(page).to have_css('button[foo][disabled]') @@ -269,7 +269,7 @@ class style visible obscured exact exact_text normalize_ws match wait end it 'does not register an offense for abstract matcher when ' \ - 'first argument is element with sub matcher' do + 'first argument is element with sub matcher' do expect_no_offenses(<<-RUBY) expect(page).to have_css('button body') expect(page).to have_css('a,h1') @@ -279,7 +279,7 @@ class style visible obscured exact exact_text normalize_ws match wait end it 'does not register an offense for abstract matcher when ' \ - 'first argument is dstr' do + 'first argument is dstr' do expect_no_offenses(<<-'RUBY') expect(page).to have_css(%{a[href="#{foo}"]}, text: "bar") RUBY diff --git a/spec/rubocop/cop/rspec/change_by_zero_spec.rb b/spec/rubocop/cop/rspec/change_by_zero_spec.rb index b7e3b32f5..d47ee9d66 100644 --- a/spec/rubocop/cop/rspec/change_by_zero_spec.rb +++ b/spec/rubocop/cop/rspec/change_by_zero_spec.rb @@ -27,7 +27,7 @@ context 'when `NegatedMatcher` is not defined (default)' do it 'registers an offense when the argument to `by` is zero ' \ - 'with compound expectations by `and`' do + 'with compound expectations by `and`' do expect_offense(<<-RUBY) it do expect { foo }.to change(Foo, :bar).by(0).and change(Foo, :baz).by(0) @@ -43,7 +43,7 @@ end it 'registers an offense when the argument to `by` is zero ' \ - 'with compound expectations by `&`' do + 'with compound expectations by `&`' do expect_offense(<<-RUBY) it do expect { foo }.to change(Foo, :bar).by(0) & change(Foo, :baz).by(0) @@ -59,7 +59,7 @@ end it 'registers an offense when the argument to `by` is zero ' \ - 'with compound expectations by `or`' do + 'with compound expectations by `or`' do expect_offense(<<-RUBY) it do expect { foo }.to change(Foo, :bar).by(0).or change(Foo, :baz).by(0) @@ -75,7 +75,7 @@ end it 'registers an offense when the argument to `by` is zero ' \ - 'with compound expectations by `|`' do + 'with compound expectations by `|`' do expect_offense(<<-RUBY) it do expect { foo }.to change(Foo, :bar).by(0) | change(Foo, :baz).by(0) @@ -92,7 +92,7 @@ context 'when with a line break' do it 'registers an offense when the argument to `by` is zero ' \ - 'with compound expectations by `and`' do + 'with compound expectations by `and`' do expect_offense(<<-RUBY) it do expect { foo } @@ -112,7 +112,7 @@ end it 'registers an offense when the argument to `by` is zero ' \ - 'with compound expectations by `&`' do + 'with compound expectations by `&`' do expect_offense(<<-RUBY) it do expect { foo } @@ -132,7 +132,7 @@ end it 'registers an offense when the argument to `by` is zero ' \ - 'with compound expectations by `or`' do + 'with compound expectations by `or`' do expect_offense(<<-RUBY) it do expect { foo } @@ -152,7 +152,7 @@ end it 'registers an offense when the argument to `by` is zero ' \ - 'with compound expectations by `|`' do + 'with compound expectations by `|`' do expect_offense(<<-RUBY) it do expect { foo } @@ -177,7 +177,7 @@ let(:cop_config) { { 'NegatedMatcher' => 'not_change' } } it 'registers an offense and autocorrect when ' \ - 'the argument to `by` is zero with compound expectations' do + 'the argument to `by` is zero with compound expectations' do expect_offense(<<-RUBY) it do expect { foo }.to change(Foo, :bar).by(0).and change(Foo, :baz).by(0) @@ -198,8 +198,8 @@ end it 'registers an offense and autocorrect when ' \ - 'the argument to `by` is zero with compound expectations ' \ - 'with line break' do + 'the argument to `by` is zero with compound expectations ' \ + 'with line break' do expect_offense(<<-RUBY) it do expect { foo } diff --git a/spec/rubocop/cop/rspec/empty_example_group_spec.rb b/spec/rubocop/cop/rspec/empty_example_group_spec.rb index 06be2e83c..7db2569ed 100644 --- a/spec/rubocop/cop/rspec/empty_example_group_spec.rb +++ b/spec/rubocop/cop/rspec/empty_example_group_spec.rb @@ -160,7 +160,7 @@ end it 'flags an empty example group with no examples defined in `case`' \ - 'branches' do + 'branches' do expect_offense(<<~RUBY) describe Foo do ^^^^^^^^^^^^ Empty example group detected. diff --git a/spec/rubocop/cop/rspec/empty_line_after_example_group_spec.rb b/spec/rubocop/cop/rspec/empty_line_after_example_group_spec.rb index e110c790b..6669aae49 100644 --- a/spec/rubocop/cop/rspec/empty_line_after_example_group_spec.rb +++ b/spec/rubocop/cop/rspec/empty_line_after_example_group_spec.rb @@ -233,7 +233,7 @@ end it 'flags a missing empty line after a `rubocop:enable` directive ' \ - 'when it is followed by a `rubocop:disable` directive' do + 'when it is followed by a `rubocop:disable` directive' do expect_offense(<<-RUBY) RSpec.describe Foo do # rubocop:disable RSpec/Foo diff --git a/spec/rubocop/cop/rspec/empty_line_after_example_spec.rb b/spec/rubocop/cop/rspec/empty_line_after_example_spec.rb index 0e7babaad..f7a81704a 100644 --- a/spec/rubocop/cop/rspec/empty_line_after_example_spec.rb +++ b/spec/rubocop/cop/rspec/empty_line_after_example_spec.rb @@ -217,7 +217,7 @@ end it 'flags a missing empty line after a `rubocop:enable` directive ' \ - 'when it is followed by a `rubocop:disable` directive' do + 'when it is followed by a `rubocop:disable` directive' do expect_offense(<<-RUBY) RSpec.describe Foo do # rubocop:disable RSpec/Foo diff --git a/spec/rubocop/cop/rspec/empty_line_after_final_let_spec.rb b/spec/rubocop/cop/rspec/empty_line_after_final_let_spec.rb index 810ab2a22..f5c34c915 100644 --- a/spec/rubocop/cop/rspec/empty_line_after_final_let_spec.rb +++ b/spec/rubocop/cop/rspec/empty_line_after_final_let_spec.rb @@ -184,7 +184,7 @@ end it 'flags a missing empty line after a `rubocop:enable` directive ' \ - 'when it is followed by a `rubocop:disable` directive' do + 'when it is followed by a `rubocop:disable` directive' do expect_offense(<<-RUBY) RSpec.describe User do # rubocop:disable RSpec/Foo diff --git a/spec/rubocop/cop/rspec/empty_line_after_hook_spec.rb b/spec/rubocop/cop/rspec/empty_line_after_hook_spec.rb index ff4aa72e3..23298f851 100644 --- a/spec/rubocop/cop/rspec/empty_line_after_hook_spec.rb +++ b/spec/rubocop/cop/rspec/empty_line_after_hook_spec.rb @@ -254,7 +254,7 @@ end it 'flags a missing empty line after a `rubocop:enable` directive ' \ - 'when it is followed by a `rubocop:disable` directive' do + 'when it is followed by a `rubocop:disable` directive' do expect_offense(<<-RUBY) RSpec.describe User do # rubocop:disable RSpec/Foo diff --git a/spec/rubocop/cop/rspec/empty_line_after_subject_spec.rb b/spec/rubocop/cop/rspec/empty_line_after_subject_spec.rb index b2b328851..6cc5e9cf1 100644 --- a/spec/rubocop/cop/rspec/empty_line_after_subject_spec.rb +++ b/spec/rubocop/cop/rspec/empty_line_after_subject_spec.rb @@ -184,7 +184,7 @@ end it 'flags a missing empty line after a `rubocop:enable` directive ' \ - 'when it is followed by a `rubocop:disable` directive' do + 'when it is followed by a `rubocop:disable` directive' do expect_offense(<<-RUBY) RSpec.describe User do # rubocop:disable RSpec/Foo diff --git a/spec/rubocop/cop/rspec/repeated_include_example_spec.rb b/spec/rubocop/cop/rspec/repeated_include_example_spec.rb index 1d9bbf886..d47e4ba07 100644 --- a/spec/rubocop/cop/rspec/repeated_include_example_spec.rb +++ b/spec/rubocop/cop/rspec/repeated_include_example_spec.rb @@ -19,7 +19,7 @@ end it "registers an offense for repeated #{include_method} " \ - 'with parentheses' do + 'with parentheses' do expect_offense(<<~RUBY, include_method: include_method) describe 'foo' do %{include_method}('an x') @@ -70,7 +70,7 @@ end it "registers an offense for repeated #{include_method} " \ - 'with parentheses' do + 'with parentheses' do expect_offense(<<~RUBY, include_method: include_method) describe 'foo' do %{include_method}('an x', 'y') @@ -107,7 +107,7 @@ end it "accepts repeated #{include_method} with different parameters " \ - 'with parentheses' do + 'with parentheses' do expect_no_offenses(<<~RUBY) describe 'foo' do #{include_method}('an x', 'y') From 7b5b9409e1de25cfec5bd0ef1aadf26c60b6208a Mon Sep 17 00:00:00 2001 From: Benjamin Quorning Date: Thu, 13 Oct 2022 22:25:56 +0200 Subject: [PATCH 3/3] Enable Style/EmptyHeredoc and fix offense --- .rubocop.yml | 2 ++ spec/rubocop/cop/rspec/empty_example_group_spec.rb | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index b43bdb782..8a0d8885e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -101,6 +101,8 @@ Layout/LineContinuationSpacing: Enabled: true Layout/LineEndStringConcatenationIndentation: Enabled: true +Style/EmptyHeredoc: + Enabled: true # Enable our own pending cops. diff --git a/spec/rubocop/cop/rspec/empty_example_group_spec.rb b/spec/rubocop/cop/rspec/empty_example_group_spec.rb index 7db2569ed..fb950453a 100644 --- a/spec/rubocop/cop/rspec/empty_example_group_spec.rb +++ b/spec/rubocop/cop/rspec/empty_example_group_spec.rb @@ -41,8 +41,7 @@ end RUBY - expect_correction(<<~RUBY) - RUBY + expect_correction('') end it 'flags example group with examples defined in hooks' do