Clean up tests. Remove templates

This commit is contained in:
bootstraponline
2014-04-05 12:46:41 -04:00
parent a7a1c4f81e
commit 452d825e66
6 changed files with 66 additions and 156 deletions
+18 -6
View File
@@ -26,7 +26,7 @@ $METADATA = false
# Make sure we're in the test dir, the tests expect that to be the current
# directory.
TEST_DIR = File.join(File.dirname(__FILE__), *%w[.])
TEST_DIR = File.join(File.dirname(__FILE__), *%w[.])
def testpath(path)
File.join(TEST_DIR, path)
@@ -64,14 +64,26 @@ def context(*args, &block)
require 'test/unit'
klass = Class.new(defined?(ActiveSupport::TestCase) ? ActiveSupport::TestCase : Test::Unit::TestCase) do
def self.test(name, &block)
define_method("test_#{name.gsub(/\W/,'_')}", &block) if block
define_method("test_#{name.gsub(/\W/, '_')}", &block) if block
end
def self.xtest(*args)
end
def self.setup(&block)
define_method(:setup, &block)
end
def self.teardown(&block)
define_method(:teardown, &block)
end
def self.xtest(*args) end
def self.setup(&block) define_method(:setup, &block) end
def self.teardown(&block) define_method(:teardown, &block) end
end
(class << klass; self end).send(:define_method, :name) { name.gsub(/\W/,'_') }
(
class << klass;
self
end).send(:define_method, :name) { name.gsub(/\W/, '_') }
$contexts << klass
klass.class_eval &block
end
$contexts = []