为什么我不能执行RSpec?

时间:2013-10-07 11:29:15

标签: ruby-on-rails ruby rspec railstutorial.org

完成Michael Hartle的教程,我无法执行RSpec;终端出现以下错误:

/Users/coreymkimball/Canvi/Tutorials/sample_app/spec/requests/static_pages_spec.rb:1:in `require': cannot load such file -- spec-helper (LoadError)
    from /Users/coreymkimball/Canvi/Tutorials/sample_app/spec/requests/static_pages_spec.rb:1:in `<top (required)>'
    from /Users/coreymkimball/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load'
    from /Users/coreymkimball/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `block in load_spec_files'
    from /Users/coreymkimball/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `each'
    from /Users/coreymkimball/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load_spec_files'
    from /Users/coreymkimball/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:22:in `run'
    from /Users/coreymkimball/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:80:in `run'
    from /Users/coreymkimball/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun'

它声明特定文件中存在加载错误;不知道如何创建一个新的,或克服这个故障排除的障碍。任何帮助都会很棒。

1 个答案:

答案 0 :(得分:1)

您可能会发现在spec目录中创建的文件名为spec_helper,而不是spec-helper。更改static_pages_spec.rb顶部的需求以反映此情况。