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

Commit b04b4e9

Browse files
committed
Deal with JRuby signal handling asynchronicity.
1 parent e6d3976 commit b04b4e9

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

spec/integration/bisect_spec.rb

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,20 +125,32 @@ def bisect_round_finished(notification)
125125
))
126126

127127
output = normalize_durations(formatter_output.string)
128-
129-
expect(output).to eq(<<-EOS.gsub(/^\s+\|/, ''))
128+
expected_start = <<-EOS.gsub(/^\s+\|/, '')
130129
|Bisect started using options: "spec/rspec/core/resources/order_dependent_specs.rb --order defined"
131130
|Running suite to find failures... (n.nnnn seconds)
132131
|Starting bisect with 1 failed example and 21 non-failing examples.
133132
|
134133
|Round 1: searching for 11 non-failing examples (of 21) to ignore: .. (n.nnnn seconds)
135134
|Round 2: searching for 6 non-failing examples (of 11) to ignore: .
135+
EOS
136+
137+
expected_end = <<-EOS.gsub(/^\s+\|/, '')
136138
|
137139
|Bisect aborted!
138140
|
139141
|The most minimal reproduction command discovered so far is:
140142
| rspec ./spec/rspec/core/resources/order_dependent_specs.rb[7:1,8:1,9:1,10:1,11:1,22:1] --order defined
141143
EOS
144+
145+
if RSpec::Support::Ruby.jruby?
146+
# For some reason, on JRuby the `Round 3:` line is also included, even though
147+
# we send SIGINT at the end of Round 2. It appears that Signal handling is
148+
# asynchronous on JRuby (maybe it happens in another thread?).
149+
expect(output).to start_with(expected_start.chomp).and end_with(expected_end)
150+
else
151+
# On MRI, the entire output is these two parts, as expected.
152+
expect(output).to eq(expected_start + expected_end)
153+
end
142154
end
143155
end
144156
end

0 commit comments

Comments
 (0)