Sha256: ce3ceb236d3ea8d335c671ac3ffdc8fbf2277a9286a3abeccd70c72a00b1d1dd
Contents?: true
Size: 1.17 KB
Versions: 6
Compression:
Stored size: 1.17 KB
Contents
require 'core_ext/concern' require 'core_ext/callbacks' module CoreExt 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 < CoreExt::TestCase # setup do # # ... # end # # teardown do # # ... # end # end module SetupAndTeardown extend CoreExt::Concern included do include CoreExt::Callbacks define_callbacks :setup, :teardown 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 # :nodoc: super run_callbacks :setup end def after_teardown # :nodoc: run_callbacks :teardown super end end end end
Version data entries
6 entries across 6 versions & 1 rubygems