diff --git a/lib/rubocop/cop/rspec/around_block.rb b/lib/rubocop/cop/rspec/around_block.rb index b3a2148e0..000e43bc8 100644 --- a/lib/rubocop/cop/rspec/around_block.rb +++ b/lib/rubocop/cop/rspec/around_block.rb @@ -27,7 +27,7 @@ module RSpec # end class AroundBlock < Base MSG_NO_ARG = 'Test object should be passed to around block.' - MSG_UNUSED_ARG = 'You should call `%<arg>s.call` '\ + MSG_UNUSED_ARG = 'You should call `%<arg>s.call` ' \ 'or `%<arg>s.run`.' def_node_matcher :hook, <<-PATTERN diff --git a/lib/rubocop/cop/rspec/be.rb b/lib/rubocop/cop/rspec/be.rb index af2cfca89..7bc5b811d 100644 --- a/lib/rubocop/cop/rspec/be.rb +++ b/lib/rubocop/cop/rspec/be.rb @@ -20,7 +20,7 @@ module RSpec # expect(foo).to be(true) # class Be < Base - MSG = 'Don\'t use `be` without an argument.' + MSG = "Don't use `be` without an argument." def_node_matcher :be_without_args, <<-PATTERN (send _ #Runners.all $(send nil? :be)) diff --git a/lib/rubocop/cop/rspec/before_after_all.rb b/lib/rubocop/cop/rspec/before_after_all.rb index 9a9d894da..7813b3d9d 100644 --- a/lib/rubocop/cop/rspec/before_after_all.rb +++ b/lib/rubocop/cop/rspec/before_after_all.rb @@ -24,9 +24,9 @@ module RSpec # after(:each) { Widget.delete_all } # end class BeforeAfterAll < Base - MSG = 'Beware of using `%<hook>s` as it may cause state to leak '\ - 'between tests. If you are using `rspec-rails`, and '\ - '`use_transactional_fixtures` is enabled, then records created '\ + MSG = 'Beware of using `%<hook>s` 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>s` are not automatically rolled back.' def_node_matcher :before_or_after_all, <<-PATTERN diff --git a/lib/rubocop/cop/rspec/describe_class.rb b/lib/rubocop/cop/rspec/describe_class.rb index 45bb737c4..96bb475b8 100644 --- a/lib/rubocop/cop/rspec/describe_class.rb +++ b/lib/rubocop/cop/rspec/describe_class.rb @@ -37,7 +37,7 @@ module RSpec class DescribeClass < Base include TopLevelGroup - MSG = 'The first argument to describe should be '\ + MSG = 'The first argument to describe should be ' \ 'the class or module being tested.' def_node_matcher :example_group_with_ignored_metadata?, <<~PATTERN diff --git a/lib/rubocop/cop/rspec/describe_method.rb b/lib/rubocop/cop/rspec/describe_method.rb index 2ff64e760..71395aaf0 100644 --- a/lib/rubocop/cop/rspec/describe_method.rb +++ b/lib/rubocop/cop/rspec/describe_method.rb @@ -19,7 +19,7 @@ module RSpec class DescribeMethod < Base include TopLevelGroup - MSG = 'The second argument to describe should be the method '\ + MSG = 'The second argument to describe should be the method ' \ "being tested. '#instance' or '.class'." def_node_matcher :second_argument, <<~PATTERN diff --git a/lib/rubocop/cop/rspec/expect_output.rb b/lib/rubocop/cop/rspec/expect_output.rb index 6c8c92938..96be00184 100644 --- a/lib/rubocop/cop/rspec/expect_output.rb +++ b/lib/rubocop/cop/rspec/expect_output.rb @@ -15,7 +15,7 @@ module RSpec # # good # expect { my_app.print_report }.to output('Hello World').to_stdout class ExpectOutput < Base - MSG = 'Use `expect { ... }.to output(...).to_%<name>s` '\ + MSG = 'Use `expect { ... }.to output(...).to_%<name>s` ' \ 'instead of mutating $%<name>s.' def on_gvasgn(node) diff --git a/lib/rubocop/cop/rspec/instance_spy.rb b/lib/rubocop/cop/rspec/instance_spy.rb index bda0f2ad9..2e76fc24e 100644 --- a/lib/rubocop/cop/rspec/instance_spy.rb +++ b/lib/rubocop/cop/rspec/instance_spy.rb @@ -21,7 +21,7 @@ module RSpec class InstanceSpy < Base extend AutoCorrector - MSG = 'Use `instance_spy` when you check your double '\ + MSG = 'Use `instance_spy` when you check your double ' \ 'with `have_received`.' def_node_search :null_double, <<-PATTERN diff --git a/lib/rubocop/cop/rspec/it_behaves_like.rb b/lib/rubocop/cop/rspec/it_behaves_like.rb index 28bf71123..ceca22406 100644 --- a/lib/rubocop/cop/rspec/it_behaves_like.rb +++ b/lib/rubocop/cop/rspec/it_behaves_like.rb @@ -22,7 +22,7 @@ class ItBehavesLike < Base extend AutoCorrector include ConfigurableEnforcedStyle - MSG = 'Prefer `%<replacement>s` over `%<original>s` when including '\ + MSG = 'Prefer `%<replacement>s` over `%<original>s` when including ' \ 'examples in a nested context.' def_node_matcher :example_inclusion_offense, '(send _ % ...)' diff --git a/lib/rubocop/cop/rspec/iterated_expectation.rb b/lib/rubocop/cop/rspec/iterated_expectation.rb index 18be6248a..4d99d9920 100644 --- a/lib/rubocop/cop/rspec/iterated_expectation.rb +++ b/lib/rubocop/cop/rspec/iterated_expectation.rb @@ -17,7 +17,7 @@ module RSpec # end class IteratedExpectation < Base MSG = 'Prefer using the `all` matcher instead ' \ - 'of iterating over an array.' + 'of iterating over an array.' def_node_matcher :each?, <<-PATTERN (block diff --git a/lib/rubocop/cop/rspec/message_spies.rb b/lib/rubocop/cop/rspec/message_spies.rb index fa30d09ee..bfbcc73d3 100644 --- a/lib/rubocop/cop/rspec/message_spies.rb +++ b/lib/rubocop/cop/rspec/message_spies.rb @@ -29,8 +29,8 @@ class MessageSpies < Base MSG_RECEIVE = 'Prefer `receive` for setting message expectations.' - MSG_HAVE_RECEIVED = 'Prefer `have_received` for setting message '\ - 'expectations. Setup `%<source>s` as a spy using '\ + MSG_HAVE_RECEIVED = 'Prefer `have_received` for setting message ' \ + 'expectations. Setup `%<source>s` as a spy using ' \ '`allow` or `instance_spy`.' SUPPORTED_STYLES = %w[have_received receive].freeze diff --git a/lib/rubocop/cop/rspec/multiple_describes.rb b/lib/rubocop/cop/rspec/multiple_describes.rb index 14c535f45..20662eeba 100644 --- a/lib/rubocop/cop/rspec/multiple_describes.rb +++ b/lib/rubocop/cop/rspec/multiple_describes.rb @@ -25,8 +25,7 @@ module RSpec class MultipleDescribes < Base include TopLevelGroup - MSG = 'Do not use multiple top-level example groups - '\ - 'try to nest them.' + MSG = 'Do not use multiple top-level example groups - try to nest them.' def on_top_level_group(node) top_level_example_groups = diff --git a/lib/rubocop/cop/rspec/scattered_setup.rb b/lib/rubocop/cop/rspec/scattered_setup.rb index 90eea5f24..6d3dbdfb8 100644 --- a/lib/rubocop/cop/rspec/scattered_setup.rb +++ b/lib/rubocop/cop/rspec/scattered_setup.rb @@ -23,7 +23,7 @@ module RSpec # end # class ScatteredSetup < Base - MSG = 'Do not define multiple `%<hook_name>s` hooks in the same '\ + MSG = 'Do not define multiple `%<hook_name>s` hooks in the same ' \ 'example group (also defined on %<lines>s).' def on_block(node) diff --git a/lib/rubocop/cop/rspec/shared_context.rb b/lib/rubocop/cop/rspec/shared_context.rb index c15f8a276..c73cecafc 100644 --- a/lib/rubocop/cop/rspec/shared_context.rb +++ b/lib/rubocop/cop/rspec/shared_context.rb @@ -53,11 +53,8 @@ module RSpec class SharedContext < Base extend AutoCorrector - MSG_EXAMPLES = "Use `shared_examples` when you don't "\ - 'define context.' - - MSG_CONTEXT = "Use `shared_context` when you don't "\ - 'define examples.' + MSG_EXAMPLES = "Use `shared_examples` when you don't define context." + MSG_CONTEXT = "Use `shared_context` when you don't define examples." def_node_search :examples?, send_pattern('{#Includes.examples #Examples.all}') diff --git a/lib/rubocop/cop/rspec/single_argument_message_chain.rb b/lib/rubocop/cop/rspec/single_argument_message_chain.rb index 77e8aef27..7e1903b5d 100644 --- a/lib/rubocop/cop/rspec/single_argument_message_chain.rb +++ b/lib/rubocop/cop/rspec/single_argument_message_chain.rb @@ -19,7 +19,7 @@ module RSpec class SingleArgumentMessageChain < Base extend AutoCorrector - MSG = 'Use `%<recommended>s` instead of calling '\ + MSG = 'Use `%<recommended>s` instead of calling ' \ '`%<called>s` with a single argument.' def_node_matcher :message_chain, <<-PATTERN diff --git a/spec/rubocop/cop/rspec/before_after_all_spec.rb b/spec/rubocop/cop/rspec/before_after_all_spec.rb index 41618109b..31c2d5cfe 100644 --- a/spec/rubocop/cop/rspec/before_after_all_spec.rb +++ b/spec/rubocop/cop/rspec/before_after_all_spec.rb @@ -2,9 +2,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 "\ + "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.' end diff --git a/spec/rubocop/cop/rspec/capybara/current_path_expectation_spec.rb b/spec/rubocop/cop/rspec/capybara/current_path_expectation_spec.rb index 619cf2e9a..f2c1a88c8 100644 --- a/spec/rubocop/cop/rspec/capybara/current_path_expectation_spec.rb +++ b/spec/rubocop/cop/rspec/capybara/current_path_expectation_spec.rb @@ -29,37 +29,37 @@ include_examples 'autocorrect', 'expect(current_path).to eq expected_path', - 'expect(page).to have_current_path expected_path, '\ + 'expect(page).to have_current_path expected_path, ' \ 'ignore_query: true' include_examples 'autocorrect', 'expect(current_path).to eq(expected_path)', - 'expect(page).to have_current_path(expected_path, '\ + 'expect(page).to have_current_path(expected_path, ' \ 'ignore_query: true)' include_examples 'autocorrect', 'expect(current_path).to(eq(expected_path))', - 'expect(page).to(have_current_path(expected_path, '\ + 'expect(page).to(have_current_path(expected_path, ' \ 'ignore_query: true))' include_examples 'autocorrect', 'expect(current_path).to eq(expected_path(f: :b))', - 'expect(page).to have_current_path(expected_path(f: :b), '\ + 'expect(page).to have_current_path(expected_path(f: :b), ' \ 'ignore_query: true)' include_examples 'autocorrect', 'expect(page.current_path).to eq(foo(bar).path)', - 'expect(page).to have_current_path(foo(bar).path, '\ + 'expect(page).to have_current_path(foo(bar).path, ' \ 'ignore_query: true)' include_examples 'autocorrect', 'expect(current_path).not_to eq expected_path', - 'expect(page).to have_no_current_path expected_path, '\ + 'expect(page).to have_no_current_path expected_path, ' \ 'ignore_query: true' include_examples 'autocorrect', 'expect(current_path).to_not eq expected_path', - 'expect(page).to have_no_current_path expected_path, '\ + 'expect(page).to have_no_current_path expected_path, ' \ 'ignore_query: true' include_examples 'autocorrect', diff --git a/spec/rubocop/cop/rspec/example_wording_spec.rb b/spec/rubocop/cop/rspec/example_wording_spec.rb index c94f2cb64..29b111930 100644 --- a/spec/rubocop/cop/rspec/example_wording_spec.rb +++ b/spec/rubocop/cop/rspec/example_wording_spec.rb @@ -44,7 +44,7 @@ RUBY end - it 'finds description with `shouldn\'t` at the beginning' do + it "finds description with `shouldn't` at the beginning" do expect_offense(<<-RUBY) it "shouldn't do something" do ^^^^^^^^^^^^^^^^^^^^^^ Do not use should when describing your tests. @@ -57,7 +57,7 @@ RUBY end - it 'finds description with `SHOULDN\'T` at the beginning' do + it "finds description with `SHOULDN'T` at the beginning" do expect_offense(<<-RUBY) it "SHOULDN'T do something" do ^^^^^^^^^^^^^^^^^^^^^^ Do not use should when describing your tests. @@ -152,8 +152,8 @@ it 'flags \-separated multiline strings' do expect_offense(<<-RUBY) - it 'should do something '\\ - ^^^^^^^^^^^^^^^^^^^^^^ Do not use should when describing your tests. + it 'should do something ' \\ + ^^^^^^^^^^^^^^^^^^^^^^^ Do not use should when describing your tests. 'and correctly fix' do end RUBY @@ -166,8 +166,8 @@ it 'flags \-separated multiline interpolated strings' do expect_offense(<<-'RUBY') - it "should do something "\ - ^^^^^^^^^^^^^^^^^^^^^^ Do not use should when describing your tests. + it "should do something " \ + ^^^^^^^^^^^^^^^^^^^^^^^ Do not use should when describing your tests. "with #{object}" do end RUBY diff --git a/spec/rubocop/rspec/example_spec.rb b/spec/rubocop/rspec/example_spec.rb index 929972642..208134a7f 100644 --- a/spec/rubocop/rspec/example_spec.rb +++ b/spec/rubocop/rspec/example_spec.rb @@ -24,7 +24,7 @@ def example(source) end it 'extracts interpolated doc string' do - expect(example("it(\"does \#{x}\")").doc_string) + expect(example('it("does #{x}")').doc_string) .to eq(s(:dstr, s(:str, 'does '), s(:begin, s(:send, nil, :x)))) end