使用rails 3.1.1中的guard发生错误

时间:2012-02-05 17:12:36

标签: ruby-on-rails ruby guard

嘿伙计们,我正在按照http://net.tutsplus.com/tutorials/ruby/the-intro-to-rails-screencast-i-wish-i-had/找到的rails教程,我已经到了使用guard执行单元测试的地步。当我使用guard时,我一直收到下面发现的错误,我尝试安装activesupport gem,但它似乎仍然失败。如果有人有任何关于如何解决这个问题的提示,我将不胜感激:))

我也在运行64位Ubuntu

chuck@chuck-laptop:~/rails/tasks$ bundle exec guard
Guard could not detect any of the supported notification libraries.
Guard is now watching at '/home/chuck/rails/tasks'
Guard::RSpec is running, with RSpec 2!
Running all specs
/home/chuck/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/test/unit/assertions.rb:5:in `<module:Test>': Unit is not a module (TypeError)
    from /home/chuck/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/test/unit/assertions.rb:4:in `<top (required)>'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `block in require'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/rspec-rails-2.8.1/lib/rspec/rails/adapters.rb:2:in `<top (required)>'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `block in require'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/rspec-rails-2.8.1/lib/rspec/rails.rb:10:in `<top (required)>'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `block in require'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
    from /home/chuck/rails/tasks/spec/spec_helper.rb:4:in `<top (required)>'
    from /home/chuck/rails/tasks/spec/requests/tasks_spec.rb:1:in `require'
    from /home/chuck/rails/tasks/spec/requests/tasks_spec.rb:1:in `<top (required)>'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `block in load_spec_files'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `map'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load_spec_files'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:22:in `run'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80:in `run_in_process'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:69:in `run'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10:in `block in autorun'
Guard::RSpec is running, with RSpec 2!
Running all specs
/home/chuck/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/test/unit/assertions.rb:5:in `<module:Test>': Unit is not a module (TypeError)
    from /home/chuck/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/test/unit/assertions.rb:4:in `<top (required)>'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `block in require'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/rspec-rails-2.8.1/lib/rspec/rails/adapters.rb:2:in `<top (required)>'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `block in require'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/rspec-rails-2.8.1/lib/rspec/rails.rb:10:in `<top (required)>'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `block in require'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
    from /home/chuck/rails/tasks/spec/spec_helper.rb:4:in `<top (required)>'
    from /home/chuck/rails/tasks/spec/requests/tasks_spec.rb:1:in `require'
    from /home/chuck/rails/tasks/spec/requests/tasks_spec.rb:1:in `<top (required)>'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `block in load_spec_files'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `map'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load_spec_files'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:22:in `run'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80:in `run_in_process'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:69:in `run'
    from /home/chuck/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10:in `block in autorun'
Bye bye...

2 个答案:

答案 0 :(得分:1)

替代方法:

  
      
  1. 从Gemfile中删除 gem。
  2.   
  3. gem uninstall turn
  4.   

我复制了解决方法from here

顺便说一句,我不想​​过于偏离主题,但如果你解决了这个问题并按照教程进行操作,那就让我给你一个建议: 如果你卡住了

Failure/Error: @task = Task.create :task => 'go to bed'
     ActiveRecord::StatementInvalid:
       Could not find table 'tasks'

然后运行此命令:

rake

问题是,而不是那个,他们告诉你运行:

rake db:migrate

哪个好,但不会迁移测试数据库。

干杯!

答案 1 :(得分:1)

作为教程的一部分,您正在关注叙述者在gem文件中使用“gem'turn'”。在阅读了一些其他博客后,我删除了一个宝石(它所做的全部是导致漂亮的测试输出)并重新捆绑。警卫终于成功了。我还有另一个错误,但它会告诉我有多少测试通过并失败,哪些是哪个。希望这会有所帮助。