I pulled the changes from the git
repo with git pull
. I then tried to run the tests in a Rails project:
$ DATABASE_ENV=test RAILS_ENV=test bundle exec rake test:all &> test.log
The tests fail with this error message:
$ cat test.log
bundler: failed to load command: rake (/Users/user_name/.rbenv/versions/2.7.3/bin/rake)
/Users/user_name/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.2.26/lib/bundler/definition.rb:490:in `materialize': Could not find addressable-2.8.0, addressable-2.8.0, addressable-2.8.0, nokogiri-1.12.5-x86_64-darwin, nokogiri-1.12.5-x86_64-darwin, racc-1.6.0, racc-1.6.0, racc-1.6.0 in any of the sources (Bundler::GemNotFound)
from /Users/user_name/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.2.26/lib/bundler/definition.rb:228:in `specs_for'
...
from /Users/user_name/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.2.26/exe/bundle:37:in `<top (required)>'
from /Users/user_name/.rbenv/versions/2.7.3/bin/bundle:23:in `load'
from /Users/user_name/.rbenv/versions/2.7.3/bin/bundle:23:in `<main>'
How can I fix this error and enable the tests to actually run?
The file Gemfile.lock
has probably changed in the repo, which causes some libraries to become missing. Make sure that this new version of the file looks OK. This can be done, for example, by comparing your old and new versions with git diff
. If these are the changes you indeed want, install the missing libraries using bundle install
:
$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Using rake 13.0.3
... [many lines]
Installing racc 1.6.0 with native extensions
Installing addressable 2.8.0
Fetching nokogiri 1.12.5 (x86_64-darwin)
Installing nokogiri 1.12.5 (x86_64-darwin)
... [many lines]
Using sass-rails 5.1.0
Bundle complete! 48 Gemfile dependencies, 122 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
SEE ALSO: