Why does my spring gem load in the wrong (or all) environment(s)?
I have this in my Gemfile and spring gem is not listed anywhere else in the file:
group :development do
gem 'listen', '~> 3.1.5'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
When I ran bundle exec rails console test
(for the test
environment), spring processes started and the Listen
module was loaded in the rails console. I made sure all spring processes were stopped beforehand.
To do a sanity check, I removed the whole development group above and bundled. Spring and listen gems were no longer loaded, as I expected.
RAILS_ENV
variable initialized? Also what version of bundler are you using? – SpragginsRAILS_ENV=test bundle exec rails console
with same issue. From rails console, I also verifiedRails.env
andGem::Specification.all_names
(list of loaded gems) – Maryettamaryjane