Created
March 30, 2011 01:06
-
-
Save norman/893678 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "test/unit" | |
Module.send :include, Module.new { | |
def test(name, &block) | |
define_method("test_#{name.gsub(/[^a-z0-9]/i, "_")}".to_sym, &block) | |
end | |
alias :should :test | |
} | |
module NumericTests | |
test "should do addition" do | |
assert_equal 2, @this + 1 | |
end | |
end | |
class IntegerTest < Test::Unit::TestCase | |
include NumericTests | |
def setup | |
@this = 1 | |
end | |
end | |
class FloatTest < Test::Unit::TestCase | |
include NumericTests | |
def setup | |
@this = 1.0 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment