Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bundler can't find rspec executable

When I try to run my tests in my Rails 5.1 app, I'm getting an error that the executable can't be found:

$ 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)>'

However, when I look in /Users/joepalmieri/.rbenv/versions/2.3.3/bin, the executable is there:

$ ls /Users/joepalmieri/.rbenv/versions/2.3.3/bin | grep rspec
// => rspec

Here are the relevant parts of my Gemfile:

gem 'rails', '~> 5.1.4'

group :development, :test do
  gem 'rspec-rails', '3.7.2'
end

Running rbenv rehash didn't help.

Any clue as to the dumb thing have I done to create this madness?

like image 200
jpalmieri Avatar asked Dec 19 '22 02:12

jpalmieri


1 Answers

Of course it was something obvious. I had run bundle install --without development test locally to test something. I didn't realize that running bundle install (unqualified) after that would repeat the install of the same groups (i.e., it wouldn't install the gems for the development and test groups).

Running bundle install --with development test fixed this.

like image 94
jpalmieri Avatar answered Dec 30 '22 08:12

jpalmieri