新增對 setup
和 teardown
回呼的支援。這些回呼用於取代覆寫您的 TestCase
的 #setup
和 #teardown
方法。
class ExampleTest < ActiveSupport::TestCase
setup do
# ...
end
teardown do
# ...
end
end
命名空間
方法
包含的模組
類別公開方法
prepended(klass) 連結
來源:顯示 | 在 GitHub 上
# File activesupport/lib/active_support/testing/setup_and_teardown.rb, line 21 def self.prepended(klass) klass.include ActiveSupport::Callbacks klass.define_callbacks :setup, :teardown klass.extend ClassMethods end