module Minitest::Hooks

Add support for around and before_all/after_all/around_all hooks to minitest spec classes.

Public Class Methods

included(mod) click to toggle source

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.

Calls superclass method
   # File lib/minitest/hooks/test.rb
 9 def self.included(mod)
10   super
11   mod.instance_exec do
12     extend(Minitest::Hooks::ClassMethods)
13   end
14 end

Public Instance Methods

after_all() click to toggle source

Empty method, necessary so that super calls in spec subclasses work.

   # File lib/minitest/hooks/test.rb
21 def after_all
22 end
around() { || ... } click to toggle source

Method that just yields, so that super calls in spec subclasses work.

   # File lib/minitest/hooks/test.rb
30 def around
31   yield
32 end
around_all() { || ... } click to toggle source

Method that just yields, so that super calls in spec subclasses work.

   # File lib/minitest/hooks/test.rb
25 def around_all
26   yield
27 end
before_all() click to toggle source

Empty method, necessary so that super calls in spec subclasses work.

   # File lib/minitest/hooks/test.rb
17 def before_all
18 end
time_it() { || ... } click to toggle source

Run around hook inside, since time_it is run around every spec.

Calls superclass method
   # File lib/minitest/hooks/test.rb
35 def time_it
36   super do
37     around do
38       yield
39     end
40   end
41 end