Skip to content

Commit c9d3b12

Browse files
committed
Avoid backslash in literal strings, when possible
1 parent 78f94bb commit c9d3b12

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lib/rubocop/cop/rspec/be.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module RSpec
2020
# expect(foo).to be(true)
2121
#
2222
class Be < Base
23-
MSG = 'Don\'t use `be` without an argument.'
23+
MSG = "Don't use `be` without an argument."
2424

2525
def_node_matcher :be_without_args, <<-PATTERN
2626
(send _ #Runners.all $(send nil? :be))

spec/rubocop/cop/rspec/example_wording_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
RUBY
4545
end
4646

47-
it 'finds description with `shouldn\'t` at the beginning' do
47+
it "finds description with `shouldn't` at the beginning" do
4848
expect_offense(<<-RUBY)
4949
it "shouldn't do something" do
5050
^^^^^^^^^^^^^^^^^^^^^^ Do not use should when describing your tests.
@@ -57,7 +57,7 @@
5757
RUBY
5858
end
5959

60-
it 'finds description with `SHOULDN\'T` at the beginning' do
60+
it "finds description with `SHOULDN'T` at the beginning" do
6161
expect_offense(<<-RUBY)
6262
it "SHOULDN'T do something" do
6363
^^^^^^^^^^^^^^^^^^^^^^ Do not use should when describing your tests.

spec/rubocop/rspec/example_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def example(source)
2424
end
2525

2626
it 'extracts interpolated doc string' do
27-
expect(example("it(\"does \#{x}\")").doc_string)
27+
expect(example('it("does #{x}")').doc_string)
2828
.to eq(s(:dstr, s(:str, 'does '), s(:begin, s(:send, nil, :x))))
2929
end
3030

0 commit comments

Comments
 (0)