Module: Minitest

Defined in:
lib/minitest/focus_plugin.rb

Defined Under Namespace

Classes: Test

Class Method Summary collapse

Class Method Details

.plugin_focus_init(options) ⇒ Object

:nodoc:



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/minitest/focus_plugin.rb', line 10

def self.plugin_focus_init options # :nodoc:
  return unless Minitest::Test.respond_to? :filtered_names
  return if Minitest::Test.filtered_names.empty?

  if options[:filter] then
    order = %w[ `focus` --name ]
    a, b = @nofocus ? order : order.reverse
    extra = " Use --no-focus to override." unless @nofocus
    warn "Ignoring #{a} filters in favor of #{b} filters.#{extra}"
    warn ""
  end

  return if @nofocus

  re = "/^(#{Regexp.union(Minitest::Test.filtered_names).source})$/"
  options[:filter] = re
end

.plugin_focus_options(opts, options) ⇒ Object



4
5
6
7
8
# File 'lib/minitest/focus_plugin.rb', line 4

def self.plugin_focus_options opts, options
  opts.on "--no-focus", "Disable `focus` calls in tests." do |n|
    @nofocus = true
  end
end