This repository was archived by the owner on Nov 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +16
-12
lines changed Expand file tree Collapse file tree 4 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,10 @@ Bug Fixes:
19
19
conflicting keys if the value in the host group was inherited from
20
20
a parent group instead of being specified at that level.
21
21
(Myron Marston, #2307 )
22
- * Handle errors in ` :suite ` hooks and provided the same nicely formatted
22
+ * Handle errors in ` :suite ` hooks and provide the same nicely formatted
23
23
output as errors that happen in examples. (Myron Marston, #2316 )
24
+ * Set the exit status to non-zero when an error occurs in an
25
+ ` after(:context) ` hook. (Myron Marston, #2320 )
24
26
25
27
### 3.5.2 / 2016-07-28
26
28
[ Full Changelog] ( http://github.com/rspec/rspec-core/compare/v3.5.1...v3.5.2 )
Original file line number Diff line number Diff line change @@ -174,11 +174,14 @@ Feature: `before` and `after` hooks
174
174
end
175
175
"""
176
176
When I run `rspec after_context_spec.rb`
177
- Then the examples should all pass
178
- And the output should contain:
177
+ Then it should fail with:
179
178
"""
180
179
An error occurred in an `after(:context)` hook.
181
- StandardError: Boom!
180
+ Failure/Error: raise StandardError.new("Boom!")
181
+
182
+ StandardError:
183
+ Boom!
184
+ # ./after_context_spec.rb:3
182
185
"""
183
186
184
187
Scenario : Define `before` and `after` blocks in configuration
Original file line number Diff line number Diff line change @@ -365,14 +365,7 @@ class AfterContextHook < Hook
365
365
def run ( example )
366
366
example . instance_exec ( example , &block )
367
367
rescue Support ::AllExceptionsExceptOnesWeMustNotRescue => e
368
- # TODO: Come up with a better solution for this.
369
- RSpec . configuration . reporter . message <<-EOS
370
-
371
- An error occurred in an `after(:context)` hook.
372
- #{ e . class } : #{ e . message }
373
- occurred at #{ e . backtrace . first }
374
-
375
- EOS
368
+ RSpec . configuration . reporter . notify_non_example_exception ( e , "An error occurred in an `after(:context)` hook." )
376
369
end
377
370
end
378
371
Original file line number Diff line number Diff line change @@ -1014,6 +1014,12 @@ def define_and_run_group(define_outer_example = false)
1014
1014
self . group . run
1015
1015
expect ( hooks_run ) . to eq [ :two , :one ]
1016
1016
end
1017
+
1018
+ it "sets `world.non_example_failure` so the exit status will be non-zero" do
1019
+ expect {
1020
+ self . group . run
1021
+ } . to change { RSpec . world . non_example_failure } . from ( a_falsey_value ) . to ( true )
1022
+ end
1017
1023
end
1018
1024
end
1019
1025
You can’t perform that action at this time.
0 commit comments