我已经安装了 Ruby 1.8.7、ci_reporter 1.8.4、测试单元 2.5.4、rake 10.0.3。
我的 testA.rb :
require 'includeA.rb'
require 'includeB.rb'
require 'includeC.rb'
require 'includeD.rb'
Begin of the code...
... End of the code
通常我使用以下 cmd 执行测试:
ruby -I E:/pathToIncludeA/includeA.rb -I E:/pathToIncludeB/includeB.rb -I E:/pathToIncludeC/includeC.rb -I E:/pathToIncludeD/includeD.rb E:/pathToTestA.rb/testA.rb
一切正常。
但是现在我正在使用 rake,并且我正在尝试以相同的方式包含目录。
这是我的 rakefile :
require 'rake/testtask'
require 'rubygems'
gem 'ci_reporter'
gem 'test-unit'
require 'test/unit'
require 'ci/reporter/rake/test_unit'
task :default => [:test]
task :test do
ruby '-I E:/pathToIncludeA/includeA.rb', '-I E:/pathToIncludeB/includeB.rb, '-I E:/pathToIncludeC/includeC.rb', '-I E:/pathToIncludeD/includeD.rb', E:/pathToTestA.rb/testA.rb
end
但是当我执行以下 cmd 时:
rake test
我有以下错误:
E:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in 'gem_original_require': no such file to load -- includeA.rb (load error)
from E:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in 'require'
from E:/pathToTestA/testA.rb/
rake aborted!
command failed with status (1): [E:/Ruby/bin/ruby.exe -I pathToIncludeA/...]
Tasks: TOP => default => test
我做错了什么?有人可以帮助我吗?