无法在Windows上的JRuby 1.6.4中启动单元测试 - 没有这样的文件可以加载 - rake

[英]Unable to launch unit tests in JRuby 1.6.4 on Windows - no such file to load — rake


I am unable to run unit tests for my Ruby on Rails application. I have JRuby 1.6.4 on Windows 7 x64 and 32x - both environments encounter the same problem.

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

When I issue the "rake test" command the output is as follows:

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

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!

For irb the "require 'rake'" command gives following output:

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

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)'

My attempts to run tests in NetBeans produce another output:

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

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 HAS a reference to rake.

Gemfile有对rake的引用。

I've found NO decent solution in Internet.

我在互联网上找不到合适的解决方案。

2 个解决方案

#1


1  

Don't know if this helps, but I was having the same problem. My solution was adding the following environment variable: RUBYOPT='-rrubygems' this caused rubygems to be automatically loaded every time and my problems went away...

不知道这是否有帮助,但我遇到了同样的问题。我的解决方案是添加以下环境变量:RUBYOPT =' - rrubygems'这导致每次都自动加载rubygems并且我的问题消失了......

#2


0  

After I uninstalled JRuby and reinstalled it to C:\jruby-1.6.4 everything went Ok. So the problem was a space sign in the path.

在我卸载JRuby并将其重新安装到C:\ jruby-1.6.4之后,一切顺利。所以问题是路径中的空间标志。

智能推荐

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.silva-art.net/blog/2012/01/25/537b5b590d117913b88f6239d868c5d8.html



 
© 2014-2019 ITdaan.com 粤ICP备14056181号  

赞助商广告