lib/minitest/should/base.rb in minitest_should-0.1.0 vs lib/minitest/should/base.rb in minitest_should-0.1.1
- old
+ new
@@ -7,10 +7,10 @@
end
module ClassMethods
def should(name, &block)
- method_name = [ "test_should_", name.downcase.gsub(/\s+/, '_') ].join
+ method_name = [ "test_should_", name.downcase.gsub(/[^a-z0-9\_\s]+/, ' ').strip.gsub(/\s+/, "_") ].join
if self.test_methods.include?(method_name)
raise MiniTest::Should::DuplicateMethodError, "Test named `#{method_name}` already exists in #{self.name}."
else
self.send(:define_method, method_name, block)
end