红宝石 1.9.2 导轨 3.1
这是问题所在bundle exec rspec spec/
不起作用,但是rspec spec/
运行正常。
当我跑步时c:\RailsInstaller\work\apptwit>bundle exec rspec spec/
(这是我的应用程序所在的目录,因此不需要指定spec的路径)
我收到
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 一样存在。
所以基本上我有两个问题:
为什么不bundle exec rspec spec/
工作的同时rspec spec/
有没有问题?
这两个命令有什么区别?
看一眼这个答案 https://stackoverflow.com/questions/8285161/what-does-it-do-by-bundle-exec-rake-dbmigrate/8285201#8285201. bundle exec
改变你的$PATH
, or %PATH%
如果是 Windows。结果,通过使用bundle exec rspec
您正在调用 RSpec 中指定的版本Gemfile
. rspec
在没有 Bundler 的情况下运行,执行您中的那个$PATH
.
您看到的错误可能是由于您的 RSpec 版本导致的$PATH
与您正在使用的 Rails 版本不兼容。 Bundler 安装并执行的版本(带有bundle exec rspec
)兼容且工作正常。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)