Module: Minitest::Hooks
- Included in:
- HooksSpec
- Defined in:
- lib/minitest/hooks.rb
Overview
Add support for around and before_all/after_all/around_all hooks to minitest spec classes.
Class Method Summary collapse
-
.included(mod) ⇒ Object
Add the class methods to the class.
Instance Method Summary collapse
-
#after_all ⇒ Object
Empty method, necessary so that super calls in spec subclasses work.
-
#around ⇒ Object
Method that just yields, so that super calls in spec subclasses work.
-
#around_all ⇒ Object
Method that just yields, so that super calls in spec subclasses work.
-
#before_all ⇒ Object
Empty method, necessary so that super calls in spec subclasses work.
-
#time_it ⇒ Object
Run around hook inside, since time_it is run around every spec.
Class Method Details
.included(mod) ⇒ Object
Add the class methods to the class. Also, include an additional module in the class that before(:all) and after(:all) methods work on a class that directly includes this module.
9 10 11 12 13 14 15 |
# File 'lib/minitest/hooks.rb', line 9 def self.included(mod) super mod.instance_exec do include(@hooks_module ||= Module.new) extend(Minitest::Hooks::ClassMethods) end end |
Instance Method Details
#after_all ⇒ Object
Empty method, necessary so that super calls in spec subclasses work.
22 23 |
# File 'lib/minitest/hooks.rb', line 22 def after_all end |
#around ⇒ Object
Method that just yields, so that super calls in spec subclasses work.
31 32 33 |
# File 'lib/minitest/hooks.rb', line 31 def around yield end |
#around_all ⇒ Object
Method that just yields, so that super calls in spec subclasses work.
26 27 28 |
# File 'lib/minitest/hooks.rb', line 26 def around_all yield end |
#before_all ⇒ Object
Empty method, necessary so that super calls in spec subclasses work.
18 19 |
# File 'lib/minitest/hooks.rb', line 18 def before_all end |
#time_it ⇒ Object
Run around hook inside, since time_it is run around every spec.
36 37 38 39 40 41 42 |
# File 'lib/minitest/hooks.rb', line 36 def time_it super do around do yield end end end |