Skip to content

Commit

Permalink
Add 'must' test helper and run tests with Rake.
Browse files Browse the repository at this point in the history
  • Loading branch information
jvoegele committed Oct 29, 2010
1 parent a3c7f22 commit e202d24
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
12 changes: 12 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
require 'rake/testtask'
require 'rake/rdoctask'

task :default => [ :test ]

desc "Executes the test suite"
Rake::TestTask.new do |t|
t.name = :test
t.libs << 'lib' << 'ext' << 'test'
t.pattern = "test/test_*.rb"
end

begin
require 'jeweler'
rescue LoadError
Expand Down
21 changes: 20 additions & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,21 @@
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))

require 'test/unit'
require File.dirname(__FILE__) + '/../lib/ehcache'
require 'ehcache'

module Test::Unit
class TestCase
def self.must(name, &block)
test_name = "test_#{name.gsub(/[\s.]+/, '_')}".to_sym
defined = instance_method(test_name) rescue false
raise "#{test_name} is already defined in #{self}" if defined
if block_given?
define_method(test_name, &block)
else
define_method(test_name) do
flunk "No implementation provided for #{name}"
end
end
end
end
end

0 comments on commit e202d24

Please sign in to comment.