Class: MiniTest::Spec
- Inherits:
-
Object
- Object
- MiniTest::Spec
- Defined in:
- lib/dominance/minitest.rb
Overview
Add some functionality to minitest/spec.
Constant Summary collapse
- @@descendants =
[]
Class Method Summary collapse
-
.inherited(test_class) ⇒ Object
We need to gather all descendants of Minitest::Spec in case their tests need to be nuked.
-
.it!(*args, &block) ⇒ Object
New it! method that dominates one test.
Class Method Details
.inherited(test_class) ⇒ Object
We need to gather all descendants of Minitest::Spec in case their tests need to be nuked.
25 26 27 28 |
# File 'lib/dominance/minitest.rb', line 25 def self.inherited test_class super @@descendants << test_class end |
.it!(*args, &block) ⇒ Object
New it! method that dominates one test. Could be implemented better.
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/dominance/minitest.rb', line 10 def self.it! *args, &block # First we need to nuke all test methods that were already defined. @@descendants.each(&:nuke_test_methods!) @@descendants = [] # Now define the test method for the dominating test. self.it *args, &block # Now make sure that no test will be defined anymore by overwriting `it`. MiniTest::Spec.class_eval do def self.it *args, &block # Empty on purpose. end end end |