问题
HI all I just recently installed rvm and all that good stuff on my macbook air and I started my rails 3.1.1 app with ruby 1.9.3. In my gem file I put down guard and rspec, now when I try and run rspec by itself or with guard I get errors thrown at me and I'm not sure why,
the output I get when I run is such,
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'
and when I run it just with normal rspec commands or using bundle's bundle exec rspec spec/requests/tasks_spec.rb I get this output,
/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'
Needless to say I'm at a lose and have no clue why it is throwing me these errors, I've never had these problems before.
回答1:
Checkout /Users/maxmarze/rails_projects/tasks/spec/spec_helper.rb
, I think you forgot rails generate rspec:install
来源:https://stackoverflow.com/questions/8024031/spec-with-guard-rails-3-1-1-and-ruby-1-9-3-getting-cannot-load-such-file-error