Test/Unit

I found Rake::TestTask incompatible with Merb – creating such a task wouldn’t load whole Merb environment, even if it was invoked from a task that had prerequisite :merb_env. The below task should work correctly, remember to

test/test_helper.rb

include Merb::Test::RequestHelper
Rakefile

desc "Run all tests (TASK=regexp to run specific files only)" 
task :test => :merb_env do
  only = ENV['TASK']
  test_files = FileList[File.join('test', '**', '*_test.rb')]
  test_files = test_files.select { |path| path =~ Regexp.new(only) } if only
  test_files.each { |f| require f }
end

Edit Page | History | Version: