2014-01-15 82 views
0

試圖運行Ruby on Rails的 - Rspec的問題

$ bundle exec rspec spec/requests/static_pages_spec.rb 

this tutorial

3.2.1章但是,我發現了以下錯誤之前測試甚至可以運行:

/Users/alexrahr/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load': cannot load such file -- /Users/alexrahr/Apps/ruby.railstutorial.org/rails_projects/sample_app/app/spec/requests/static_pages_spec.rb (LoadError) 
from /Users/alexrahr/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `block in load_spec_files' 
from /Users/alexrahr/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `each' 
from /Users/alexrahr/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load_spec_files' 
from /Users/alexrahr/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:22:in `run' 
from /Users/alexrahr/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:80:in `run' 
from /Users/alexrahr/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun' 

任何想法可能是什麼?我猜這是我沒有安裝RSpec gem?

+0

FYI剛纔檢查,我在寶石文件中確實有Rspec的 '組:發展:測試做 寶石 'sqlite3的', '1.3.8' 寶石 'RSpec的護欄', '2.13.1' 結束 組:測試做 寶石 '硒webdriver的', '2.35.1' 寶石 '水豚', '2.1.0' end' –

+0

解決了它 - 試圖從錯誤的文件夾運行命令... –

回答

0

據我所知道的投機/目錄巢是基於規範的類型:

  • 的型號規格:規格/型號/ user_spec.rb
  • 的控制器規格:規格/控制器/ users_controller_spec.rb

另外,還要確保你跑耙RSpec的:束後安裝命令

bundle && rake rspec:install 

的錯誤清楚地表明你正在嘗試運行該文件在目錄中找不到你說這是在