From dfbbdd090d175f0016efd9471847595df159f525 Mon Sep 17 00:00:00 2001 From: Bill Ruddock Date: Tue, 4 Aug 2020 01:45:42 +0100 Subject: [PATCH] Fix line continuations in spec examples Fix backslash before newline. --- .../cop/layout/multiline_method_call_indentation_spec.rb | 2 +- .../cop/layout/multiline_operation_indentation_spec.rb | 6 +++--- spec/rubocop/cop/style/redundant_percent_q_spec.rb | 8 ++++---- .../cop/style/string_literals_in_interpolation_spec.rb | 2 +- spec/rubocop/cop/style/string_literals_spec.rb | 8 ++++---- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/spec/rubocop/cop/layout/multiline_method_call_indentation_spec.rb b/spec/rubocop/cop/layout/multiline_method_call_indentation_spec.rb index 2d0c44baa631..9ce6c650ab1c 100644 --- a/spec/rubocop/cop/layout/multiline_method_call_indentation_spec.rb +++ b/spec/rubocop/cop/layout/multiline_method_call_indentation_spec.rb @@ -459,7 +459,7 @@ def investigate(processed_source) end it 'does not check binary operations when string wrapped with backslash' do - expect_no_offenses(<<~RUBY) + expect_no_offenses(<<~'RUBY') flash[:error] = 'Here is a string ' \ 'That spans' << 'multiple lines' diff --git a/spec/rubocop/cop/layout/multiline_operation_indentation_spec.rb b/spec/rubocop/cop/layout/multiline_operation_indentation_spec.rb index 291cb036cba7..ffb56f39073e 100644 --- a/spec/rubocop/cop/layout/multiline_operation_indentation_spec.rb +++ b/spec/rubocop/cop/layout/multiline_operation_indentation_spec.rb @@ -325,7 +325,7 @@ def config_to_allow_offenses it 'registers an offense and corrects misaligned string operand ' \ 'when the first operand has backslash continuation' do - expect_offense(<<~RUBY) + expect_offense(<<~'RUBY') def f flash[:error] = 'Here is a string ' \ 'That spans' << @@ -334,7 +334,7 @@ def f end RUBY - expect_correction(<<~RUBY) + expect_correction(<<~'RUBY') def f flash[:error] = 'Here is a string ' \ 'That spans' << @@ -459,7 +459,7 @@ def f end it 'accepts the indentation of a broken string' do - expect_no_offenses(<<~RUBY) + expect_no_offenses(<<~'RUBY') MSG = 'Use 2 (not %d) spaces for indenting a ' \ 'broken line.' RUBY diff --git a/spec/rubocop/cop/style/redundant_percent_q_spec.rb b/spec/rubocop/cop/style/redundant_percent_q_spec.rb index 52948e599501..5fbc94e62597 100644 --- a/spec/rubocop/cop/style/redundant_percent_q_spec.rb +++ b/spec/rubocop/cop/style/redundant_percent_q_spec.rb @@ -68,11 +68,11 @@ end it 'auto-corrects for strings that is concated with backslash' do - new_source = autocorrect_source(<<~RUBY) + new_source = autocorrect_source(<<~'RUBY') %q(foo bar baz) \ 'boogers' RUBY - expect(new_source).to eq(<<~RUBY) + expect(new_source).to eq(<<~'RUBY') 'foo bar baz' \ 'boogers' RUBY @@ -142,11 +142,11 @@ end it 'auto-corrects for strings that is concated with backslash' do - new_source = autocorrect_source(<<~RUBY) + new_source = autocorrect_source(<<~'RUBY') %Q(foo bar baz) \ 'boogers' RUBY - expect(new_source).to eq(<<~RUBY) + expect(new_source).to eq(<<~'RUBY') "foo bar baz" \ 'boogers' RUBY diff --git a/spec/rubocop/cop/style/string_literals_in_interpolation_spec.rb b/spec/rubocop/cop/style/string_literals_in_interpolation_spec.rb index beb92923c64f..d4a11356946c 100644 --- a/spec/rubocop/cop/style/string_literals_in_interpolation_spec.rb +++ b/spec/rubocop/cop/style/string_literals_in_interpolation_spec.rb @@ -26,7 +26,7 @@ end it 'accepts double quotes on a broken static string' do - expect_no_offenses(<<~RUBY) + expect_no_offenses(<<~'RUBY') "A" \ "B" RUBY diff --git a/spec/rubocop/cop/style/string_literals_spec.rb b/spec/rubocop/cop/style/string_literals_spec.rb index 2cde4e12833c..0436426cde7e 100644 --- a/spec/rubocop/cop/style/string_literals_spec.rb +++ b/spec/rubocop/cop/style/string_literals_spec.rb @@ -300,7 +300,7 @@ end it 'accepts continued strings using all single quotes' do - expect_no_offenses(<<~RUBY) + expect_no_offenses(<<~'RUBY') 'abc' \ 'def' RUBY @@ -330,7 +330,7 @@ end it "doesn't register offense for double quotes with embedded single" do - expect_no_offenses(<<~RUBY) + expect_no_offenses(<<~'RUBY') "abc'" \ "def" RUBY @@ -369,7 +369,7 @@ end it 'accepts continued strings using all double quotes' do - expect_no_offenses(<<~RUBY) + expect_no_offenses(<<~'RUBY') "abc" \ "def" RUBY @@ -392,7 +392,7 @@ end it "doesn't register offense for single quotes with embedded double" do - expect_no_offenses(<<~RUBY) + expect_no_offenses(<<~'RUBY') 'abc"' \ 'def' RUBY