This repository was archived by the owner on Nov 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +36
-12
lines changed Expand file tree Collapse file tree 2 files changed +36
-12
lines changed Original file line number Diff line number Diff line change 8
8
let ( :failure_exit_code ) { rand ( 97 ) + 2 } # 2..99
9
9
let ( :error_exit_code ) { failure_exit_code + 2 } # 4..101
10
10
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?
12
14
let ( :spec_line_suffix ) { ":in `block in (root)'" }
13
15
elsif RSpec ::Support ::Ruby . jruby?
14
16
let ( :spec_line_suffix ) { ":in `(root)'" }
@@ -97,6 +99,19 @@ def run_spec_expecting_non_zero(before_or_after)
97
99
end
98
100
"
99
101
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
+ "\n "
113
+ end
114
+
100
115
run_command "the_spec.rb"
101
116
expect ( last_cmd_exit_status ) . to eq ( error_exit_code )
102
117
output = normalize_durations ( last_cmd_stdout )
@@ -116,14 +131,14 @@ def run_spec_expecting_non_zero(before_or_after)
116
131
RuntimeError:
117
132
after 2
118
133
# ./the_spec.rb:6#{ spec_line_suffix }
119
-
134
+ #{ cause }
120
135
An error occurred in an `after(:suite)` hook.
121
136
Failure/Error: c.after(:suite) { raise 'after 1' }
122
137
123
138
RuntimeError:
124
139
after 1
125
140
# ./the_spec.rb:5#{ spec_line_suffix }
126
-
141
+ #{ cause }
127
142
128
143
Finished in n.nnnn seconds (files took n.nnnn seconds to load)
129
144
0 examples, 0 failures, 3 errors occurred outside of examples
Original file line number Diff line number Diff line change @@ -66,6 +66,9 @@ def normalize_backtraces(failure)
66
66
end
67
67
68
68
def normalize_one_backtrace ( exception )
69
+ if RSpec ::Support ::Ruby . jruby_9000? && RSpec ::Support ::Ruby . jruby_version >= '9.2.0.0'
70
+ pending "On JRuby 9.2.x.x these specs are broken due to no backtrace."
71
+ end
69
72
line = exception . backtrace . find { |l | l . include? ( __FILE__ ) }
70
73
exception . set_backtrace ( [ line . sub ( /:in .*$/ , '' ) ] )
71
74
end
@@ -117,16 +120,22 @@ def normalize_one_backtrace(exception)
117
120
end
118
121
119
122
context "due to using `:aggregate_failures` metadata" do
120
- let ( :exception ) do
121
- ex = nil
122
- RSpec . describe do
123
- ex = it "" , :aggregate_failures do
124
- expect ( 1 ) . to fail_with_description ( "foo" )
125
- expect ( 1 ) . to fail_with_description ( "bar" )
126
- end
127
- end . run
123
+ if RSpec ::Support ::Ruby . jruby_9000? && RSpec ::Support ::Ruby . jruby_version >= '9.2.0.0'
124
+ let ( :exception ) do
125
+ pending "On JRuby 9.2.x.x these specs are broken due to no backtrace."
126
+ end
127
+ else
128
+ let ( :exception ) do
129
+ ex = nil
130
+ RSpec . describe do
131
+ ex = it "" , :aggregate_failures do
132
+ expect ( 1 ) . to fail_with_description ( "foo" )
133
+ expect ( 1 ) . to fail_with_description ( "bar" )
134
+ end
135
+ end . run
128
136
129
- capture_and_normalize_aggregation_error { raise ex . execution_result . exception }
137
+ capture_and_normalize_aggregation_error { raise ex . execution_result . exception }
138
+ end
130
139
end
131
140
132
141
it 'uses an alternate format for the exception summary to avoid confusing references to the aggregation block or stack trace' do
You can’t perform that action at this time.
0 commit comments