首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在Windows1.6.4中启动单元测试-没有要加载的文件-- rake

无法在Windows1.6.4中启动单元测试-没有要加载的文件-- rake
EN

Stack Overflow用户
提问于 2012-01-26 03:12:28
回答 2查看 580关注 0票数 1

我无法为我的Ruby on Rails应用程序运行单元测试。我在Windows7 x64和32x上使用的是JRuby 1.6.4 --这两种环境都遇到了同样的问题。

当我发出"rake test“命令时,输出如下:

代码语言:javascript
复制
JRuby limited openssl loaded. http://jruby.org/openssl
gem install jruby-openssl for full support.
rake/rdoctask is deprecated.  Use rdoc/task instead (in RDoc 2.4.2+)
WARNING: Global access to Rake DSL methods is deprecated.  Please include
    ...  Rake::DSL into classes and modules which use the Rake DSL methods.
WARNING: DSL method TrainerWeb::Application#task called at C:/Program Files/jruby-1.6.4/lib/ruby/gems/1.8/gems/railties-3.0.4/lib/rails/application.rb:214:in `initialize_tasks'
DEPRECATION WARNING: Rake tasks in D:/Work/P/Documents/NetBeansProjects/myproject/vendor/plugins/restful-authentication/tasks/auth.rake are deprecated. Use lib/tasks instead. (called from (root) at D:/Work/P/Documents/NetBeansProjects/myproject/Rakefile:13)
LoadError: no such file to load -- rake
  require at org/jruby/RubyKernel.java:1038
   (root) at C:/Program Files/jruby-1.6.4/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/rake_test_loader.rb:1
LoadError: no such file to load -- rake
  require at org/jruby/RubyKernel.java:1038
   (root) at C:/Program Files/jruby-1.6.4/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/rake_test_loader.rb:1
LoadError: no such file to load -- rake
  require at org/jruby/RubyKernel.java:1038
   (root) at C:/Program Files/jruby-1.6.4/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/rake_test_loader.rb:1
Errors running test:units, test:functionals, test:integration!

对于irb,"require 'rake'“命令会给出以下输出:

代码语言:javascript
复制
irb(main):001:0> require 'rake'
LoadError: no such file to load -- rake
        from org/jruby/RubyKernel.java:1038:in `require'
    from (irb):1:in `evaluate'
    from org/jruby/RubyKernel.java:1088:in `eval'
    from C:/Program Files/jruby-1.6.4/lib/ruby/1.8/irb.rb:158:in `eval_input'
    from C:/Program Files/jruby-1.6.4/lib/ruby/1.8/irb.rb:271:in `signal_status'
    from C:/Program Files/jruby-1.6.4/lib/ruby/1.8/irb.rb:155:in `eval_input'
    from org/jruby/RubyKernel.java:1419:in `loop'
    from org/jruby/RubyKernel.java:1191:in `catch'
    from C:/Program Files/jruby-1.6.4/lib/ruby/1.8/irb.rb:154:in `eval_input'
    from C:/Program Files/jruby-1.6.4/lib/ruby/1.8/irb.rb:71:in `start'
    from org/jruby/RubyKernel.java:1191:in `catch'
    from C:/Program Files/jruby-1.6.4/lib/ruby/1.8/irb.rb:70:in `start'
    from C:\Program Files\jruby-1.6.4\bin\irb:13:in `(root)'

我尝试在NetBeans中运行测试时会产生另一个输出:

代码语言:javascript
复制
Test-unit version : 2.4.5 loaded
JRuby limited openssl loaded. http://jruby.org/openssl
gem install jruby-openssl for full support.
rake/rdoctask is deprecated.  Use rdoc/task instead (in RDoc 2.4.2+)
WARNING: Global access to Rake DSL methods is deprecated.  Please include
    ...  Rake::DSL into classes and modules which use the Rake DSL methods.
WARNING: DSL method TrainerWeb::Application#task called at C:/Program Files/jruby-1.6.4/lib/ruby/gems/1.8/gems/railties-3.0.4/lib/rails/application.rb:214:in `initialize_tasks'
DEPRECATION WARNING: Rake tasks in D:/Work/P/Documents/NetBeansProjects/myproject/vendor/plugins/restful-authentication/tasks/auth.rake are deprecated. Use lib/tasks instead. (called from (root) at D:/Work/P/Documents/NetBeansProjects/myproject/Rakefile:13)
'"C:/Program Files/jruby-1.6.4/bin/jruby.bat.exe"' is not recognized as an internal or external command,
operable program or batch file.
'"C:/Program Files/jruby-1.6.4/bin/jruby.bat.exe"' is not recognized as an internal or external command,
operable program or batch file.
'"C:/Program Files/jruby-1.6.4/bin/jruby.bat.exe"' is not recognized as an internal or external command,
operable program or batch file.
Errors running test:units, test:functionals, test:integration!

Finished in 0.0 seconds.
0 tests, 0 failures, 0 errors

Gemfile引用了rake。

我在互联网上找不到像样的解决方案。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-03-21 20:50:24

卸载JRuby并将其重新安装到C:\jruby-1.6.4后,一切正常。所以问题是路径中的一个空格符号。

票数 0
EN

Stack Overflow用户

发布于 2012-03-16 05:43:00

不知道这有没有帮助,但我也有同样的问题。我的解决方案是添加以下环境变量: RUBYOPT='-rrubygems‘这导致每次自动加载rubygems,我的问题就消失了……

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9008731

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档