- My app works.
- I was able to run tests before, and now for some reason I can't.
- What happened between now and then is that I vendorized
activesupport
(but I have since undone those changes, and in fact I am in a totally separate/unrelated branch). - Two commands I ran during my work on
activesupport
that I am unfamiliar with arebundle --deployment
andbundle --no-deployment
. Again, I believe I undid everything related to those changes (at least as far asgit status
is concerned - I always rungit status
, and am aware of all codebase changes).
I am aware that other people have had similar, but not this exact problem: https://stackoverflow.com/search?q=require+cannot+load+such+file+LoadError
I was playing around with vendorizing activesupport
following this:
How to vendor a modified version of active_support such that it is used in my Rails app?
And I had trouble when I tried pushing the vendorized activesupport
branch to staging
:
Where is 'elsewhere' in "run `bundle install` elsewhere"?
Anyway, the point is that my app works (i.e. all the gems are obviously installed, Gemfile
and Gemfile.lock
are intact), yet I cannot run tests:
/Users/bsimpson/.rvm/gems/ruby-2.0.0-p481@books/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:229:in `require': cannot load such file -- minitest/rails (LoadError)
from /Users/bsimpson/.rvm/gems/ruby-2.0.0-p481@books/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:229:in `block in require'
from /Users/bsimpson/.rvm/gems/ruby-2.0.0-p481@books/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:214:in `load_dependency'
from /Users/bsimpson/.rvm/gems/ruby-2.0.0-p481@books/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:229:in `require'
from /Volumes/MyHD/Users/bsimpson/Dev/books/books/test/test_helper.rb:10:in `<top (required)>'
from test/controllers/photos_controller_test.rb:1:in `require'
from test/controllers/photos_controller_test.rb:1:in `<main>'
If I comment out line 10
of test/test_helper.rb
, it just complains about the next require
line.
dependencies.rb:229:in `require': cannot load such file -- minitest/rails/capybara (LoadError)
...
test/test_helper.rb:14:in `<top (required)>'
And when I comment out line 14
, it complains about the next require
line, and so on...
So it seems that in the test
environment, the gems aren't seen. Thoughts?
.bundle/config
---
BUNDLE_WITHOUT: development:test
The configuration
BUNDLE_WITHOUT: development:test
tells Bundler not to load gems from thedevelopment
andtest
groups. Since this is your only configuration setting, you can safely delete the.bundle/config
file and things should go back to working for you.Alternatively, you could leave the file and only delete that line.
Is it possible that when you ran
bundle --deployment
, you actually ranbundle --deployment --without development test
? These options are commonly used together, and options passed tobundle install
(orbundle
without a sub-command, which defaults toinstall
) are remembered in thebundle/.config
file. These options are "sticky" until they are explicitly removed, so if you use the--without
flag once, you'll need to edit the file to get those groups back.Also note that
.bundle/config
is usually excluded from git, so checkinggit status
won't tell you if it changed. These settings are often machine-dependent, so it's a good idea to keep it excluded from git.