添加了对 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