【问题标题】:Cannot generate rails command: bundle exec rspec spec/requests无法生成 rails 命令:bundle exec rspec spec/requests
【发布时间】:2013-11-15 06:40:45
【问题描述】:

我正在尝试启动第二个 Rails 项目,而对于我的第一个项目,rspec 运行良好。我复制了 Gemfile 以获得相同的 gem,并且我的项目文件中有 spec/requests 目录。但是,当我尝试执行时出现此错误

C:\Sites\rails_projects\friendapp\app\views\static_pages>bundle exec rspec spec/ 要求 C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec /core/configuration.rb:780:in load': cannot load such file -- C:/Sites/rails_pr ojects/friendapp/app/views/static_pages/spec/requests (LoadError) from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.1 1.1/lib/rspec/core/configuration.rb:780:inblock in load_spec_files' 来自 C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.1 1.1/lib/rspec/core/configuration.rb:780:in map' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.1 1.1/lib/rspec/core/configuration.rb:780:inload_spec_files' 来自 C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.1 1.1/lib/rspec/core/command_line.rb:22:in run' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.1 1.1/lib/rspec/core/runner.rb:69:inrun' 来自 C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.1 1.1/lib/rspec/core/runner.rb:8:in `block in autorun'

有什么线索吗?谢谢!

【问题讨论】:

  • 您是否在新项目中运行了bundle install

标签: ruby-on-rails ruby ruby-on-rails-3


【解决方案1】:

您似乎不是从应用的根目录执行 bundle exec,而是从 app\views\static_pages:

C:\Sites\rails_projects\friendapp\app\views\static_pages>

错误消息表明该位置不存在该文件 (static_pages):

C:/Sites/rails_projects/friendapp/app/views/static_pages/spec/requests

切换到根目录并重试

C:\Sites\rails_projects\friendapp\>bundle exec rspec spec/requests 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-26
    相关资源
    最近更新 更多