Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
test/spec/mini 3
# test/spec/mini 3
# file:lib/test/spec/mini.rb
def context(*args, &block)
return super unless (name = args.first) && block
require 'test/unit'
klass = ? ActiveSupport::TestCase : Test::Unit::TestCase) do
def self.test(name, &block)
define_method("test_#{name.gsub(/\W/,'_')}", &block) if block
def self.xtest(*args) end
def self.setup(&block) define_method(:setup, &block) end
def self.teardown(&block) define_method(:teardown, &block) end
(class << klass; self end).send(:define_method, :name) { name.gsub(/\W/,'_') }
klass.class_eval &block
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.