Class: MiniTest::Should::TestCase
- Inherits:
-
MiniTest::Spec
- Object
- MiniTest::Spec
- MiniTest::Should::TestCase
- Defined in:
- lib/minitest/should/test_case.rb
Class Method Summary collapse
Class Method Details
.should(name, &block) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/minitest/should/test_case.rb', line 11 def self.should(name, &block) 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 end |