未验证 提交 00f2dbd0 编写于 作者: R Rafael França 提交者: GitHub

Merge pull request #32472 from Edouard-chin/ec-activesupport-teardown

`SetupAndTeardown#teardown` should call any subsequent after_teardown:
......@@ -44,8 +44,15 @@ def before_setup # :nodoc:
end
def after_teardown # :nodoc:
run_callbacks :teardown
begin
run_callbacks :teardown
rescue => e
error = e
end
super
ensure
raise error if error
end
end
end
......
# frozen_string_literal: true
require "abstract_unit"
module OtherAfterTeardown
def after_teardown
@witness = true
end
end
class AfterTeardownTest < Minitest::Test
include OtherAfterTeardown
include ActiveSupport::Testing::SetupAndTeardown
attr_writer :witness
MyError = Class.new(StandardError)
teardown do
raise MyError, "Test raises an error, all after_teardown should still get called"
end
def after_teardown
assert_raises MyError do
super
end
assert_equal true, @witness
end
def test_teardown_raise_but_all_after_teardown_method_are_called
assert true
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册