class MiniTest::Unit::TestCase

Public Class Methods

check_suites() click to toggle source
# File lib/minitest-check.rb, line 18
def self.check_suites
  TestCase.test_suites.reject {
    |s| s.check_methods.empty?
  }.map {|s|
    s.generate_suites
  }.flatten
end
check_with(generator) click to toggle source
# File lib/minitest-check.rb, line 35
def check_with(generator)
  @contexts ||= []
  # It would be nice if Minitest lazily iterated through its tests, calling one-by-one.
  # Then we could feed new tests into the generator as the system run or depending on
  # external data sources. It's a departure from the unit testing that Minitest is built for,
  # but it is a use-case I'm trying to cover here.
  @contexts += generator.to_a
end
contexts() click to toggle source
# File lib/minitest-check.rb, line 31
def contexts
  @contexts or superclass.respond_to?(:contexts) ? superclass.contexts : []
end
generate_suites() click to toggle source
# File lib/minitest-check.rb, line 55
def generate_suites
  contexts.map {|c| Check::SuiteWrapper.new(self, c) }
end
seed(num = 1, &blk) click to toggle source

Convenience method to run a block a certain number of times

# File lib/minitest-check.rb, line 45
def seed(num = 1, &blk)
  check_with(Enumerator.new {|contexts|
    num.times {|i| contexts << blk.call(i)}
  })
end
seed_value(hash_or_object) click to toggle source
# File lib/minitest-check.rb, line 51
def seed_value(hash_or_object)
  check_with([hash_or_object])
end