【问题标题】:Rails console not working with redgreen gemRails 控制台不适用于红绿宝石
【发布时间】:2012-06-26 19:21:02
【问题描述】:

我在使用 rails 控制台时遇到问题,这是我尝试启动 rails 控制台时遇到的问题:

backo@speedy:~/ucimrails/simple_app$ rails c --sandbox /home/backo/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in require': no such file to load -- test/unit/ui/console/testrunner (LoadError) from /home/backo/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:inblock in require' 来自/home/backo/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:236:in load_dependency' from /home/backo/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:inrequire' 来自/home/backo/.rvm/gems/ruby-1.9.2-p320/gems/redgreen-1.2.2/lib/redgreen.rb:2:in <top (required)>' from /home/backo/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:68:inrequire' 来自 /home/backo/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:68:in block (2 levels) in require' from /home/backo/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:66:ineach' 来自 /home/backo/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:66:in block in require' from /home/backo/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:ineach' 来自 /home/backo/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:in require' from /home/backo/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler.rb:119:inrequire' 来自/home/backo/ucimrails/simple_app/config/application.rb:13:in <top (required)>' from /home/backo/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.2/lib/rails/commands.rb:39:inrequire' 来自/home/backo/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.2/lib/rails/commands.rb:39:in <top (required)>' from script/rails:6:inrequire' 来自脚本/rails:6:in `'

我发现问题是由红绿宝石引起的。当我从 Gemfile 中排除它时,控制台再次工作。但是,有人可以帮我让它与红绿宝石一起使用吗?有趣的是,这只发生在我的上网本上,当我在台式电脑上工作时,rails 控制台一切正常。

【问题讨论】:

    标签: ruby-on-rails-3 rails-console redgreen


    【解决方案1】:

    在我的 Gemfile 中指定:

    gem 'test-unit', '1.2.3'
    

    ...似乎适用于 1.9.3 和 Rails 3.2.8。但是,最好将它与更新版本的测试单元一起使用(看起来 2.5.2 是最新的)...

    【讨论】:

      【解决方案2】:

      红绿宝石不适用于 1.9.2;对于 redgreen 测试输出,您可以尝试

      require 'test/unit'
      require 'test/unit/ui/console/testrunner'   
      
      class Test::Unit::UI::Console::TestRunner
        def guess_color_availability; true; end
      end
      

      在你的测试助手中。

      【讨论】:

      • 这样做似乎对我没有任何改变。
      • 嗯,它确实在这里工作。您是在 Gemfile 中指定了 test/unit 还是依赖于 ruby​​ 1.9 捆绑的 test/unit?
      猜你喜欢
      • 2011-02-08
      • 2010-12-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-22
      • 1970-01-01
      • 2011-09-12
      • 1970-01-01
      相关资源
      最近更新 更多