|
9 | 9 |
|
10 | 10 | # Setup some shared examples and call them in a separate file
|
11 | 11 | # from where they are called to demonstrate how nested example ids work
|
12 |
| - write_file "some_examples.rb", " |
| 12 | + write_file_formatted "some_examples.rb", " |
13 | 13 | RSpec.shared_examples_for 'a failing spec' do
|
14 | 14 | it 'fails' do
|
15 | 15 | expect(1).to eq(2)
|
|
26 | 26 | file = cd('.') { "#{Dir.pwd}/some_examples.rb" }
|
27 | 27 | load file
|
28 | 28 |
|
29 |
| - write_file "non_local_shared_examples_spec.rb", " |
| 29 | + write_file_formatted "non_local_shared_examples_spec.rb", " |
30 | 30 | RSpec.describe do
|
31 | 31 | context 'the first context' do
|
32 | 32 | it_behaves_like 'a failing spec'
|
|
39 | 39 | "
|
40 | 40 |
|
41 | 41 | # Setup some shared examples in the same file as where they are called
|
42 |
| - write_file "local_shared_examples_spec.rb", " |
| 42 | + write_file_formatted "local_shared_examples_spec.rb", " |
43 | 43 | RSpec.describe do
|
44 | 44 | shared_examples_for 'a failing spec' do
|
45 | 45 | it 'fails' do
|
|
107 | 107 | expect(last_cmd_stdout).to include unindent(<<-EOS)
|
108 | 108 | Failed examples:
|
109 | 109 |
|
110 |
| - rspec ./local_shared_examples_spec.rb:4 # the first context behaves like a failing spec fails |
111 |
| - rspec ./local_shared_examples_spec.rb:9 # the first context behaves like a failing spec when you reverse it still fails |
112 |
| - rspec ./local_shared_examples_spec.rb:4 # the second context behaves like a failing spec fails |
113 |
| - rspec ./local_shared_examples_spec.rb:9 # the second context behaves like a failing spec when you reverse it still fails |
| 110 | + rspec ./local_shared_examples_spec.rb:3 # the first context behaves like a failing spec fails |
| 111 | + rspec ./local_shared_examples_spec.rb:8 # the first context behaves like a failing spec when you reverse it still fails |
| 112 | + rspec ./local_shared_examples_spec.rb:3 # the second context behaves like a failing spec fails |
| 113 | + rspec ./local_shared_examples_spec.rb:8 # the second context behaves like a failing spec when you reverse it still fails |
114 | 114 | EOS
|
115 | 115 | end
|
116 | 116 | end
|
|
122 | 122 | expect(last_cmd_stdout).to include unindent(<<-EOS)
|
123 | 123 | Failed examples:
|
124 | 124 |
|
125 |
| - rspec ./non_local_shared_examples_spec.rb:4 # the first context behaves like a failing spec fails |
126 |
| - rspec ./non_local_shared_examples_spec.rb:4 # the first context behaves like a failing spec when you reverse it still fails |
127 |
| - rspec ./non_local_shared_examples_spec.rb:8 # the second context behaves like a failing spec fails |
128 |
| - rspec ./non_local_shared_examples_spec.rb:8 # the second context behaves like a failing spec when you reverse it still fails |
| 125 | + rspec ./non_local_shared_examples_spec.rb:3 # the first context behaves like a failing spec fails |
| 126 | + rspec ./non_local_shared_examples_spec.rb:3 # the first context behaves like a failing spec when you reverse it still fails |
| 127 | + rspec ./non_local_shared_examples_spec.rb:7 # the second context behaves like a failing spec fails |
| 128 | + rspec ./non_local_shared_examples_spec.rb:7 # the second context behaves like a failing spec when you reverse it still fails |
129 | 129 | EOS
|
130 | 130 | end
|
131 | 131 | end
|
|
0 commit comments