Added test/do declaration style testing to ActiveSupport::TestCase [DHH via Jay Fields]

This commit is contained in:
David Heinemeier Hansson 2008-06-12 20:10:38 -05:00
parent 048ac3604c
commit f74ba37f4e
2 changed files with 11 additions and 1 deletions

@ -1,5 +1,7 @@
*Edge*
* Added test/do declaration style testing to ActiveSupport::TestCase [DHH via Jay Fields]
* Added Object#present? which is equivalent to !Object#blank? [DHH]
* Added Enumberable#several? to encapsulate collection.size > 1 [DHH]

@ -9,5 +9,13 @@ class Test::Unit::TestCase #:nodoc:
module ActiveSupport
class TestCase < Test::Unit::TestCase
# test "verify something" do
# ...
# end
def self.test(name, &block)
test_name = "test_#{name.gsub(/[\s]/,'_')}".to_sym
raise "#{test_name} is already defined in #{self}" if self.instance_methods.include?(test_name.to_s)
define_method(test_name, &block)
end
end
end
end