Module: ActiveSupport::Testing::SetupAndTeardown
- Extended by:
- Concern
- Included in:
- ActiveSupport::TestCase
- Defined in:
- 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
-
#after_teardown ⇒ Object
:nodoc:.
-
#before_setup ⇒ Object
:nodoc:.
Methods included from Concern
append_features, class_methods, extended, included
Instance Method Details
#after_teardown ⇒ Object
:nodoc:
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/active_support/testing/setup_and_teardown.rb', line 46 def after_teardown # :nodoc: begin run_callbacks :teardown rescue => e error = e end super ensure raise error if error end |
#before_setup ⇒ Object
:nodoc:
41 42 43 44 |
# File 'lib/active_support/testing/setup_and_teardown.rb', line 41 def before_setup # :nodoc: super run_callbacks :setup end |