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

Commit e4b605d

Browse files
committed
Fix build for JRuby 9.2.x.x
1 parent 08ef2ee commit e4b605d

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

spec/integration/suite_hooks_errors_spec.rb

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
let(:failure_exit_code) { rand(97) + 2 } # 2..99
99
let(:error_exit_code) { failure_exit_code + 2 } # 4..101
1010

11-
if RSpec::Support::Ruby.jruby_9000?
11+
if RSpec::Support::Ruby.jruby_9000? && RSpec::Support::Ruby.jruby_version > '9.2.0.0'
12+
let(:spec_line_suffix) { ":in `block in <main>'" }
13+
elsif RSpec::Support::Ruby.jruby_9000?
1214
let(:spec_line_suffix) { ":in `block in (root)'" }
1315
elsif RSpec::Support::Ruby.jruby?
1416
let(:spec_line_suffix) { ":in `(root)'" }
@@ -97,6 +99,19 @@ def run_spec_expecting_non_zero(before_or_after)
9799
end
98100
"
99101

102+
cause =
103+
if RSpec::Support::Ruby.jruby_9000? && RSpec::Support::Ruby.jruby_version > '9.2.0.0'
104+
unindent(<<-EOS)
105+
# ------------------
106+
# --- Caused by: ---
107+
# RuntimeError:
108+
# before 1
109+
# ./the_spec.rb:3:in `block in <main>'
110+
EOS
111+
else
112+
""
113+
end
114+
100115
run_command "the_spec.rb"
101116
expect(last_cmd_exit_status).to eq(error_exit_code)
102117
output = normalize_durations(last_cmd_stdout)
@@ -116,14 +131,14 @@ def run_spec_expecting_non_zero(before_or_after)
116131
RuntimeError:
117132
after 2
118133
# ./the_spec.rb:6#{spec_line_suffix}
119-
134+
#{ cause }
120135
An error occurred in an `after(:suite)` hook.
121136
Failure/Error: c.after(:suite) { raise 'after 1' }
122137
123138
RuntimeError:
124139
after 1
125140
# ./the_spec.rb:5#{spec_line_suffix}
126-
141+
#{ cause }
127142
128143
Finished in n.nnnn seconds (files took n.nnnn seconds to load)
129144
0 examples, 0 failures, 3 errors occurred outside of examples

0 commit comments

Comments
 (0)