When you develop a gem and you have a Gemfile
in your project directory, you might be surprised that your gem dependencies aren't already required in your specs. Here is some info that should help you out:
Bundler.require(:default, :your_custom_group1, ...)
for that. The reason why you never had to write this line is that Rails does this for you when it boots the environment.spec
folder (like
has_defaults
Show archive.org snapshot
), and you boot its environment, it should call Bundler.require
for you and you don't need to require anything yourself.ENV["BUNDLE_GEMFILE"]
in preinitializer.rb
points to the correct file if you're organizing your Gemfiles
in funny ways.Bundler.require
, Bundler will only require gems that are directly quoted in your Gemfile
. It will not require gems that are dependencies of these gems. It's the job of a gem to require its dependencies. E.g. if you're working on consul
which depends on memoizer
, consul needs to say require 'memoizer'
in lib/consul.rb
or similiar.