Class: MiniTest::Unit::TestCase
- Inherits:
-
Object
- Object
- MiniTest::Unit::TestCase
- Defined in:
- lib/minitest/focus4.rb
Overview
:nodoc:
Class Method Summary collapse
-
.focus ⇒ Object
Focus on the next test defined.
Class Method Details
.focus ⇒ Object
Focus on the next test defined. Cumulative. Equivalent to running with command line arg: -n /test_name|…/
class MyTest < MiniTest::Unit::TestCase
...
focus
def test_pass; ... end # this one will run
...
end
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/minitest/focus4.rb', line 13 def self.focus opts = MiniTest::Unit.runner. = class << self; self; end opts[:names] ||= [] .send :define_method, :method_added do |name| opts[:names] << name.to_s opts[:filter] = "/^(#{Regexp.union(opts[:names]).source})$/" .send :remove_method, :method_added end end |