Sha256: e2f4ea62d2e28a9b786c15dadfca8e6e13a8df35b6d412b5766411a7e51e1878
Contents?: true
Size: 695 Bytes
Versions: 2
Compression:
Stored size: 695 Bytes
Contents
module MiniTest module Should module Base def self.included(base) base.extend ClassMethods end module ClassMethods def 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 end end end end MiniTest::Unit::TestCase.send(:include, MiniTest::Should::Base)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
minitest_should-0.2.0 | lib/minitest/should/base.rb |
minitest_should-0.1.1 | lib/minitest/should/base.rb |