W3cubDocs

/Ruby on Rails 7.0

module ActiveSupport::Testing::SetupAndTeardown

Included modules:
ActiveSupport::Callbacks

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

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

  teardown do
    # ...
  end
end

Public Class Methods

prepended(klass) Show source
# 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

© 2004–2021 David Heinemeier Hansson
Licensed under the MIT License.