Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit e4a2897

Browse files
committed
Triple quotes aren’t really a thing.
Ruby concatenates strings that are next to each other, though, so it’s a blank string concatenated with a longer multi-line string concatenated with another blank string.
1 parent 4ac3b66 commit e4a2897

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

spec/integration/filtering_spec.rb

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
before { clean_current_dir }
66

77
it 'prints a rerun command for shared examples in external files that works to rerun' do
8-
write_file "spec/support/shared_examples.rb", """
8+
write_file "spec/support/shared_examples.rb", "
99
RSpec.shared_examples 'with a failing example' do
1010
example { expect(1).to eq(2) } # failing
1111
example { expect(2).to eq(2) } # passing
1212
end
13-
"""
13+
"
1414

15-
write_file "spec/host_group_spec.rb", """
15+
write_file "spec/host_group_spec.rb", "
1616
load File.expand_path('../support/shared_examples.rb', __FILE__)
1717
1818
RSpec.describe 'A group with shared examples' do
@@ -22,7 +22,7 @@
2222
RSpec.describe 'A group with a passing example' do
2323
example { expect(1).to eq(1) }
2424
end
25-
"""
25+
"
2626

2727
run_command ""
2828
expect(last_cmd_stdout).to include("3 examples, 1 failure")
@@ -40,7 +40,7 @@ def run_rerun_command_for_failing_spec
4040

4141
context "with a shared example containing a context in a separate file" do
4242
it "runs the example nested inside the shared" do
43-
write_file_formatted 'spec/shared_example.rb', """
43+
write_file_formatted 'spec/shared_example.rb', "
4444
RSpec.shared_examples_for 'a shared example' do
4545
it 'succeeds' do
4646
end
@@ -50,15 +50,15 @@ def run_rerun_command_for_failing_spec
5050
end
5151
end
5252
end
53-
"""
53+
"
5454

55-
write_file_formatted 'spec/simple_spec.rb', """
55+
write_file_formatted 'spec/simple_spec.rb', "
5656
require File.join(File.dirname(__FILE__), 'shared_example.rb')
5757
5858
RSpec.describe 'top level' do
5959
it_behaves_like 'a shared example'
6060
end
61-
"""
61+
"
6262

6363
run_command 'spec/simple_spec.rb:3 -fd'
6464
expect(last_cmd_stdout).to match(/2 examples, 0 failures/)
@@ -67,7 +67,7 @@ def run_rerun_command_for_failing_spec
6767

6868
context "passing a line-number filter" do
6969
it "trumps exclusions, except for :if/:unless (which are absolute exclusions)" do
70-
write_file_formatted 'spec/a_spec.rb', """
70+
write_file_formatted 'spec/a_spec.rb', "
7171
RSpec.configure do |c|
7272
c.filter_run_excluding :slow
7373
end
@@ -82,7 +82,7 @@ def run_rerun_command_for_failing_spec
8282
example('ex 4', :slow ) { }
8383
example('ex 5', :if => false) { }
8484
end
85-
"""
85+
"
8686

8787
run_command "spec/a_spec.rb -fd"
8888
expect(last_cmd_stdout).to include("1 example, 0 failures", "ex 3").and exclude("ex 1", "ex 2", "ex 4", "ex 5")
@@ -100,14 +100,14 @@ def run_rerun_command_for_failing_spec
100100

101101
context "passing a line-number-filtered file and a non-filtered file" do
102102
it "applies the line number filtering only to the filtered file, running all specs in the non-filtered file except excluded ones" do
103-
write_file_formatted "spec/file_1_spec.rb", """
103+
write_file_formatted "spec/file_1_spec.rb", "
104104
RSpec.describe 'File 1' do
105105
it('passes') { }
106106
it('fails') { fail }
107107
end
108-
"""
108+
"
109109

110-
write_file_formatted "spec/file_2_spec.rb", """
110+
write_file_formatted "spec/file_2_spec.rb", "
111111
RSpec.configure do |c|
112112
c.filter_run_excluding :exclude_me
113113
end
@@ -117,7 +117,7 @@ def run_rerun_command_for_failing_spec
117117
it('passes') { }
118118
it('fails', :exclude_me) { fail }
119119
end
120-
"""
120+
"
121121

122122
run_command "spec/file_1_spec.rb:2 spec/file_2_spec.rb -fd"
123123
expect(last_cmd_stdout).to match(/3 examples, 0 failures/)
@@ -127,21 +127,21 @@ def run_rerun_command_for_failing_spec
127127

128128
context "passing example ids at the command line" do
129129
it "selects matching examples" do
130-
write_file_formatted "spec/file_1_spec.rb", """
130+
write_file_formatted "spec/file_1_spec.rb", "
131131
RSpec.describe 'File 1' do
132132
1.upto(3) do |i|
133133
example('ex ' + i.to_s) { expect(i).to be_odd }
134134
end
135135
end
136-
"""
136+
"
137137

138-
write_file_formatted "spec/file_2_spec.rb", """
138+
write_file_formatted "spec/file_2_spec.rb", "
139139
RSpec.describe 'File 2' do
140140
1.upto(3) do |i|
141141
example('ex ' + i.to_s) { expect(i).to be_even }
142142
end
143143
end
144-
"""
144+
"
145145

146146
# Using the form that Metadata.relative_path returns...
147147
run_command "./spec/file_1_spec.rb[1:1,1:3] ./spec/file_2_spec.rb[1:2]"
@@ -162,7 +162,7 @@ def run_rerun_command_for_failing_spec
162162
end
163163

164164
it "selects matching example groups" do
165-
write_file_formatted "spec/file_1_spec.rb", """
165+
write_file_formatted "spec/file_1_spec.rb", "
166166
RSpec.describe 'Group 1' do
167167
example { fail }
168168
@@ -175,7 +175,7 @@ def run_rerun_command_for_failing_spec
175175
example { fail }
176176
end
177177
end
178-
"""
178+
"
179179

180180
run_command "./spec/file_1_spec.rb[1:2]"
181181
expect(last_cmd_stdout).to match(/2 examples, 0 failures/)

spec/integration/order_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
include_context "aruba support"
55

66
before :all do
7-
write_file 'spec/simple_spec.rb', """
7+
write_file 'spec/simple_spec.rb', "
88
RSpec.describe 'group 1' do
99
specify('group 1 example 1') {}
1010
specify('group 1 example 2') {}
@@ -15,9 +15,9 @@
1515
specify('group 1-1 example 3') {}
1616
end
1717
end
18-
"""
18+
"
1919

20-
write_file 'spec/simple_spec2.rb', """
20+
write_file 'spec/simple_spec2.rb', "
2121
RSpec.describe 'group 2' do
2222
specify('group 2 example 1') {}
2323
specify('group 2 example 2') {}
@@ -28,9 +28,9 @@
2828
specify('group 2-1 example 3') {}
2929
end
3030
end
31-
"""
31+
"
3232

33-
write_file 'spec/order_spec.rb', """
33+
write_file 'spec/order_spec.rb', "
3434
RSpec.describe 'group 1' do
3535
specify('group 1 example 1') {}
3636
specify('group 1 example 2') {}
@@ -76,7 +76,7 @@
7676
RSpec.describe('group 8') { specify('example') {} }
7777
RSpec.describe('group 9') { specify('example') {} }
7878
RSpec.describe('group 10') { specify('example') {} }
79-
"""
79+
"
8080
end
8181

8282
describe '--order rand' do
@@ -150,7 +150,7 @@
150150
after { remove_file 'spec/custom_order_spec.rb' }
151151

152152
before do
153-
write_file 'spec/custom_order_spec.rb', """
153+
write_file 'spec/custom_order_spec.rb', "
154154
RSpec.configure do |config|
155155
config.register_ordering :global do |list|
156156
list.sort_by { |item| item.description }
@@ -167,7 +167,7 @@
167167
RSpec.describe 'group A' do
168168
specify('group A example 1') {}
169169
end
170-
"""
170+
"
171171
end
172172

173173
it 'orders the groups and examples by the provided strategy' do

0 commit comments

Comments
 (0)