当我尝试在我的Rails 5.1应用程序中运行测试时,我收到一条错误,指出找不到可执行文件:
$ bundle exec rspec
bundler: failed to load command: rspec (/Users/joepalmieri/.rbenv/versions/2.3.3/bin/rspec)
Gem::Exception: can't find executable rspec
/Users/joepalmieri/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.14.6/lib/bundler/rubygems_integration.rb:408:in `block in replace_bin_path'
/Users/joepalmieri/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.14.6/lib/bundler/rubygems_integration.rb:434:in `block in replace_bin_path'
/Users/joepalmieri/.rbenv/versions/2.3.3/bin/rspec:22:in `<top (required)>'
然而,当我查看/Users/joepalmieri/.rbenv/versions/2.3.3/bin
时,可执行文件就在那里:
$ ls /Users/joepalmieri/.rbenv/versions/2.3.3/bin | grep rspec
// => rspec
以下是我的Gemfile的相关部分:
gem 'rails', '~> 5.1.4'
group :development, :test do
gem 'rspec-rails', '3.7.2'
end
正在运行rbenv rehash
没有帮助。
关于这个愚蠢的事情的任何线索我都是为了制造这种疯狂吗?
答案 0 :(得分:3)
当然这很明显。我在本地运行bundle install --without development test
来测试一些东西。我没有意识到在此之后运行bundle install
(不合格)将重复安装相同的组(即,它不会为development
和{{1安装宝石}}。)。
正在运行test
修复此问题。