首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >捆绑exec rspec与rspec规范

捆绑exec rspec与rspec规范
EN

Stack Overflow用户
提问于 2011-11-27 18:56:39
回答 1查看 18.3K关注 0票数 8

Ruby1.9.2 Rails 3.1

这是bundle exec rspec spec/不能工作的问题,但是rspec spec/运行正常。

当我运行c:\RailsInstaller\work\apptwit>bundle exec rspec spec/时(这是我的应用程序所在的目录,因此不需要指定到规范的路径)

代码语言:javascript
复制
c:/RailsInstaller/work/apptwit/spec/controllers/pages_controller_spec.rb:1:in `require': no such file to load -- spec_he lper (LoadError)
        from c:/RailsInstaller/work/apptwit/spec/controllers/pages_controller_spec.rb:1:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:i
n `load'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:i
n `block in load_spec_files'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:i
n `map'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:i
n `load_spec_files'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rspec-core-2.7.1/lib/rspec/core/command_line.rb:18:in
`run'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:80:in `run_i
n_process'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:69:in `run'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:10:in `block
 in autorun'

/spec目录与它中存在的spec_helper.rb一样存在。

基本上,我有两个问题:

  1. 为什么bundle exec rspec spec/rspec spec/没有问题的情况下不能工作?
  2. 这两个命令之间有什么区别?
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-11-27 19:14:25

看看this answer。如果使用bundle execbundle exec会更改您的$PATH%PATH%。因此,通过使用bundle exec rspec,您将调用在Gemfile中指定的RSpec版本。没有绑定器的rspec运行将执行$PATH中的一个。

您看到的错误可能是由于您的RSpec版本与您正在使用的Rails版本不兼容造成的。由bundle exec rspec安装和执行的版本是兼容的,工作正常。

票数 26
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8288143

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档