From 8c27090013ff4e7c4984a7dbdc33f3c8dfa72235 Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Sat, 8 Sep 2007 14:28:01 +0000 Subject: [PATCH] ActionItem8: including a 'should' in test_helper --- test/test_helper.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+), 0 deletions(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index 16e6665..5517511 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -35,6 +35,19 @@ class Test::Unit::TestCase end end + def self.should(name, &block) + @shoulds ||= [] + + destname = 'test_should_' + name.gsub(/[^a-zA-z0-9]+/, '_') + if @shoulds.include?(destname) + raise "there is already a test named \"#{destname}\"" + end + + @shoulds << destname + self.send(:define_method, destname, &block) + + end + private def uses_host(name) -- libgit2 0.21.2