跳至内容 跳至搜索

添加对 setupteardown 回调的支持。这些回调用作覆盖 #setup#teardown 方法的替代方案 TestCase.

class ExampleTest < ActiveSupport::TestCase
  setup do
    # ...
  end

  teardown do
    # ...
  end
end
命名空间
方法
P
包含的模块

类公共方法

预置(klass)

# 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