class MiniTest::Spec

def self.after(type = :each, &block)

def self.after(type = :each, &block)
  raise "unsupported after type: #{type}" unless type == :each
  define_inheritable_method :teardown, &block
end

def self.before(type = :each, &block)

def self.before(type = :each, &block)
  raise "unsupported before type: #{type}" unless type == :each
  define_inheritable_method :setup, &block
end

def self.current

def self.current
  @@current_spec
end

def self.define_inheritable_method name, &block

def self.define_inheritable_method name, &block
  super_method = self.superclass.instance_method name
  define_method name do
    super_method.bind(self).call if super_method # regular super() warns
    instance_eval(&block)
  end
end

def self.describe_stack

def self.describe_stack
  @@describe_stack
end

def self.it desc, &block

def self.it desc, &block
  define_method "test_#{desc.gsub(/\W+/, '_').downcase}", &block
end

def self.nuke_test_methods!

def self.nuke_test_methods!
  self.public_instance_methods.grep(/^test_/).each do |name|
    send :remove_method, name rescue nil
  end
end

def initialize name

def initialize name
  super
  @@current_spec = self
end