Reputation: 96827
I'd like to see all the gems that are loaded for the test
environment, with versions and dependencies. Is such a thing possible?
Upvotes: 0
Views: 146
Reputation: 54684
You could roll your own:
require 'bundler/setup'
group = :development
deps = Bundler.load.dependencies.select do |dep|
dep.groups.include?(group) or dep.groups.include?(:default)
end
puts "Gems included by the bundle in group #{group}:"
deps.each do |dep|
spec = dep.to_spec
puts "* #{spec.name} (#{spec.version})"
end
Example Gemfile
:
source 'https://rubygems.org'
gem 'sinatra'
gem 'thor'
group :test do
gem 'rspec'
end
group :development do
gem 'rspec'
gem 'pry'
end
Example output:
Gems included by the bundle in group development:
* sinatra (1.4.1)
* thor (0.17.0)
* rspec (2.13.0)
* pry (0.9.12)
Upvotes: 3
Reputation: 6501
It should already the there in your Gemfile
Anything in a block that specifies test will be part of your test environment, anything outside of the test block but not in another block would also be loaded.
All of the dependencies should be listed in the Gemfile.lock
EDIT
OK, based on your feedback, this should do what you want.
Rails c test
to open a console in the test environment
pp Gem.loaded_specs.sort
This will prettyprint all of the specs in alphabetical order
Upvotes: 1