aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2013-06-19 14:45:49 +0200
committerYves Senn <yves.senn@gmail.com>2013-06-19 14:45:49 +0200
commitb6a711f5f44d86554001ddd2ce52f19039073bd2 (patch)
treed7ce7d37b3fcc2bf4408b6083a94a957c9ce3d94 /activesupport/lib
parent33c1b466447f3413654ddb158cb5111a200e23f1 (diff)
downloadrails-b6a711f5f44d86554001ddd2ce52f19039073bd2.tar.gz
rails-b6a711f5f44d86554001ddd2ce52f19039073bd2.tar.bz2
rails-b6a711f5f44d86554001ddd2ce52f19039073bd2.zip
add documentation for `ActiveSupport::Testing::SetupAndTeardown`.
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/testing/setup_and_teardown.rb19
1 files changed, 17 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/testing/setup_and_teardown.rb b/activesupport/lib/active_support/testing/setup_and_teardown.rb
index a65148cf1f..33f2b8dc9b 100644
--- a/activesupport/lib/active_support/testing/setup_and_teardown.rb
+++ b/activesupport/lib/active_support/testing/setup_and_teardown.rb
@@ -3,6 +3,19 @@ require 'active_support/callbacks'
module ActiveSupport
module Testing
+ # Adds support for +setup+ and +teardown+ callbacks.
+ # These callbacks serve as a replacement to overwriting the
+ # <tt>#setup</tt> and <tt>#teardown</tt> methods of your TestCase.
+ #
+ # class ExampleTest < ActiveSupport::TestCase
+ # setup do
+ # # ...
+ # end
+ #
+ # teardown do
+ # # ...
+ # end
+ # end
module SetupAndTeardown
extend ActiveSupport::Concern
@@ -12,21 +25,23 @@ module ActiveSupport
end
module ClassMethods
+ # Add a callback, which runs before <tt>TestCase#setup</tt>.
def setup(*args, &block)
set_callback(:setup, :before, *args, &block)
end
+ # Add a callback, which runs after <tt>TestCase#teardown</tt>.
def teardown(*args, &block)
set_callback(:teardown, :after, *args, &block)
end
end
- def before_setup
+ def before_setup # :nodoc:
super
run_callbacks :setup
end
- def after_teardown
+ def after_teardown # :nodoc:
run_callbacks :teardown
super
end