1

我在使用 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' from /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' from /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' from /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:inrequire' from /home/backo/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler.rb:119:in来自 /home/backo/ucimrails/simple_app/config/application.rb:13<top (required)>' from /home/backo/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.2/lib/rails/commands.rb:39:in的要求:来自 /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' from script/rails:6:in `'

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

4

2 回答 2

2

在我的 Gemfile 中指定:

gem 'test-unit', '1.2.3'

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

于 2012-10-02T00:51:43.610 回答
0

redgreen gem 不适用于 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

在你的测试助手左右。

于 2012-08-19T16:43:07.807 回答