Module: Minitest::Hooks
- Included in:
- HooksSpec
- Defined in:
- lib/minitest/hooks/test.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 |
# File 'lib/minitest/hooks/test.rb', line 9 def self.included(mod) super mod.instance_exec do extend(Minitest::Hooks::ClassMethods) end end |
Instance Method Details
#after_all ⇒ Object
Empty method, necessary so that super calls in spec subclasses work.
21 22 |
# File 'lib/minitest/hooks/test.rb', line 21 def after_all end |
#around ⇒ Object
Method that just yields, so that super calls in spec subclasses work.
30 31 32 |
# File 'lib/minitest/hooks/test.rb', line 30 def around yield end |
#around_all ⇒ Object
Method that just yields, so that super calls in spec subclasses work.
25 26 27 |
# File 'lib/minitest/hooks/test.rb', line 25 def around_all yield end |
#before_all ⇒ Object
Empty method, necessary so that super calls in spec subclasses work.
17 18 |
# File 'lib/minitest/hooks/test.rb', line 17 def before_all end |
#time_it ⇒ Object
Run around hook inside, since time_it is run around every spec.
35 36 37 38 39 40 41 |
# File 'lib/minitest/hooks/test.rb', line 35 def time_it super do around do yield end end end |