module Minitest::Allow

Constants

VERSION

Attributes

allow[RW]
allow_save[RW]
allow_seen[RW]

Public Instance Methods

allow_results() click to toggle source
# File lib/minitest/allow_plugin.rb, line 47
def allow_results
  self.reporters
    .grep(Minitest::StatisticsReporter)
    .map(&:results)
end
filter_allow() click to toggle source
# File lib/minitest/allow_plugin.rb, line 63
def filter_allow
  maybe_bad = allow_results.flatten.map(&:full_name).uniq
  to_remove = maybe_bad & allow
  extra_bad = maybe_bad - to_remove

  self.allow -= to_remove

  allow_results.each do |results|
    results.delete_if { |r| to_remove.include? r.full_name }
  end

  unless extra_bad.empty? then
    io.puts
    io.puts "Bad tests that are NOT allowed:"
    io.puts
    io.puts extra_bad.to_yaml
  end
end
passed?() click to toggle source
Calls superclass method
# File lib/minitest/allow_plugin.rb, line 95
def passed?
  write_allow        if allow_save
  filter_allow       if allow
  report_extra_allow if allow

  super # CompositeReporter#passed?
end
record(result) click to toggle source
Calls superclass method
# File lib/minitest/allow_plugin.rb, line 42
def record result
  allow_seen << result.full_name
  super
end
report_extra_allow() click to toggle source
# File lib/minitest/allow_plugin.rb, line 82
def report_extra_allow
  good = allow & allow_seen

  unless good.empty? then
    io.puts
    io.puts "Excluded tests that now pass:"
    io.puts
    good.each do |name|
      io.puts "  :allow_good: %p" % [name]
    end
  end
end
write_allow() click to toggle source
# File lib/minitest/allow_plugin.rb, line 53
def write_allow
  data = allow_results
    .flatten
    .map(&:full_name)
    .uniq
    .sort

  File.write allow_save, data.to_yaml
end