spec with guard,rails 3.1.1和ruby 1.9.3获取无法加载此类文件错误

时间:2011-11-05 23:14:31

标签: ruby-on-rails ruby rspec rspec2 rspec-rails

我最近刚刚在macbook air上安装了rvm和所有好东西,我用ruby 1.9.3启动了我的rails 3.1.1应用程序。在我的宝石文件中,我放下了警卫和rspec,现在当我尝试自己运行rspec或使用警卫时,我会向我发出错误,我不知道为什么,

我跑步时得到的输出就是这样,

phantom:tasks maxmarze$ guard
Please install rb-fsevent gem for Mac OSX FSEvents support
Using polling (Please help us to support your system better than that).
Please install growl_notify or growl gem for Mac OS X notification support and add it to your Gemfile
Guard is now watching at '/Users/maxmarze/rails_projects/tasks'
Guard::RSpec is running, with RSpec 2!
Running all specs
/Users/maxmarze/rails_projects/tasks/spec/requests/tasks_spec.rb:1:in `require': cannot load such file -- spec_helper (LoadError)
    from /Users/maxmarze/rails_projects/tasks/spec/requests/tasks_spec.rb:1:in `<top (required)>'
    from /Users/maxmarze/.rvm/gems/ruby-1.9.3-head/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:in `load'
    from /Users/maxmarze/.rvm/gems/ruby-1.9.3-head/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:in `block in load_spec_files'
    from /Users/maxmarze/.rvm/gems/ruby-1.9.3-head/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:in `map'
    from /Users/maxmarze/.rvm/gems/ruby-1.9.3-head/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:in `load_spec_files'
    from /Users/maxmarze/.rvm/gems/ruby-1.9.3-head/gems/rspec-core-2.7.1/lib/rspec/core/command_line.rb:18:in `run'
    from /Users/maxmarze/.rvm/gems/ruby-1.9.3-head/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:80:in `run_in_process'
    from /Users/maxmarze/.rvm/gems/ruby-1.9.3-head/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:69:in `run'
    from /Users/maxmarze/.rvm/gems/ruby-1.9.3-head/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:10:in `block in autorun'
Guard::RSpec is running, with RSpec 2!
Running all specs
/Users/maxmarze/rails_projects/tasks/spec/requests/tasks_spec.rb:1:in `require': cannot load such file -- spec_helper (LoadError)
    from /Users/maxmarze/rails_projects/tasks/spec/requests/tasks_spec.rb:1:in `<top (required)>'
    from /Users/maxmarze/.rvm/gems/ruby-1.9.3-head/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:in `load'
    from /Users/maxmarze/.rvm/gems/ruby-1.9.3-head/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:in `block in load_spec_files'
    from /Users/maxmarze/.rvm/gems/ruby-1.9.3-head/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:in `map'
    from /Users/maxmarze/.rvm/gems/ruby-1.9.3-head/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:in `load_spec_files'
    from /Users/maxmarze/.rvm/gems/ruby-1.9.3-head/gems/rspec-core-2.7.1/lib/rspec/core/command_line.rb:18:in `run'
    from /Users/maxmarze/.rvm/gems/ruby-1.9.3-head/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:80:in `run_in_process'
    from /Users/maxmarze/.rvm/gems/ruby-1.9.3-head/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:69:in `run'
    from /Users/maxmarze/.rvm/gems/ruby-1.9.3-head/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:10:in `block in autorun'

当我使用普通的rspec命令或使用bundle的bundle exec rspec spec / requests / tasks_spec.rb运行它时,我得到了这个输出,

/Users/maxmarze/rails_projects/tasks/spec/requests/tasks_spec.rb:1:in `require': cannot load such file -- spec_helper (LoadError)
    from /Users/maxmarze/rails_projects/tasks/spec/requests/tasks_spec.rb:1:in `<top (required)>'
    from /Users/maxmarze/.rvm/gems/ruby-1.9.3-head/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:in `load'
    from /Users/maxmarze/.rvm/gems/ruby-1.9.3-head/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:in `block in load_spec_files'
    from /Users/maxmarze/.rvm/gems/ruby-1.9.3-head/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:in `map'
    from /Users/maxmarze/.rvm/gems/ruby-1.9.3-head/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:in `load_spec_files'
    from /Users/maxmarze/.rvm/gems/ruby-1.9.3-head/gems/rspec-core-2.7.1/lib/rspec/core/command_line.rb:18:in `run'
    from /Users/maxmarze/.rvm/gems/ruby-1.9.3-head/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:80:in `run_in_process'
    from /Users/maxmarze/.rvm/gems/ruby-1.9.3-head/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:69:in `run'
    from /Users/maxmarze/.rvm/gems/ruby-1.9.3-head/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:10:in `block in autorun'

毋庸置疑,我已经输了,并且不知道为什么它会给我带来这些错误,我以前从未遇到过这些问题。

1 个答案:

答案 0 :(得分:3)

结帐/Users/maxmarze/rails_projects/tasks/spec/spec_helper.rb,我想你忘记了rails generate rspec:install