123456789_123456789_123456789_123456789_123456789_

Module: ActiveSupport::Testing::SetupAndTeardown

Overview

Adds support for setup and teardown callbacks. These callbacks serve as a replacement to overwriting the #setup and #teardown methods of your ::ActiveSupport::TestCase.

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

  teardown do
    # ...
  end
end

Class Method Summary

Class Method Details

.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