Module: ActiveSupport::Testing::SetupAndTeardown

Extended by:
Concern
Included in:
ActiveSupport::TestCase
Defined in:
activesupport/lib/active_support/testing/setup_and_teardown.rb

Overview

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

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Methods included from Concern

append_features, extended, included

Instance Method Details

#after_teardownObject

:nodoc:



44
45
46
47
# File 'activesupport/lib/active_support/testing/setup_and_teardown.rb', line 44

def after_teardown # :nodoc:
  run_callbacks :teardown
  super
end

#before_setupObject

:nodoc:



39
40
41
42
# File 'activesupport/lib/active_support/testing/setup_and_teardown.rb', line 39

def before_setup # :nodoc:
  super
  run_callbacks :setup
end