Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ensure the things that happen after the return val is set

  • Loading branch information...
commit 20389a49ae3501bfe7f17f60ea76ef81bdd781d7 1 parent 0bbbaed
@dchelimsky dchelimsky authored
Showing with 12 additions and 8 deletions.
  1. +12 −8 lib/rspec/core/example_group.rb
View
20 lib/rspec/core/example_group.rb
@@ -187,19 +187,23 @@ def self.eval_after_alls(running_example)
def self.run(reporter)
example_group_instance = new
reporter.add_example_group(self)
- eval_before_alls(example_group_instance)
- success = run_examples(example_group_instance, reporter)
- eval_after_alls(example_group_instance)
- success
+ begin
+ eval_before_alls(example_group_instance)
+ run_examples(example_group_instance, reporter)
+ ensure
+ eval_after_alls(example_group_instance)
+ end
end
# Runs all examples, returning true only if all of them pass
def self.run_examples(instance, reporter)
examples_to_run.map do |example|
- result = example.run(instance, reporter)
- instance.__reset__
- before_all_ivars.each {|k, v| instance.instance_variable_set(k, v)}
- result
+ begin
+ example.run(instance, reporter)
+ ensure
+ instance.__reset__
+ before_all_ivars.each {|k, v| instance.instance_variable_set(k, v)}
+ end
end.all?
end
Please sign in to comment.
Something went wrong with that request. Please try again.