Using Groups

Grouping your dependencies allows you to perform operations on the entire group.
# These gems are in the :default group
gem 'nokogiri'
gem 'sinatra'

gem 'wirble', :group => :development

group :test do
  gem 'faker'
  gem 'rspec'

group :test, :development do
  gem 'capybara'
  gem 'rspec-rails'

gem 'cucumber', :group => [:cucumber, :test]

Install all gems, except those in the listed groups. Gems in at least one non-excluded group will still be installed.
$ bundle install --without test development

Require the gems in particular groups, noting that gems outside of a named group are in the :default group
Bundler.require(:default, :development)

Require the default gems, plus the gems in a group named the same as the current Rails environment
Bundler.require(:default, Rails.env)

Restrict the groups of gems that you want to add to the load path. Only gems in these groups will be require'able
require 'rubygems'
require 'bundler'
Bundler.setup(:default, :ci)
require 'nokogiri'
Learn More: Bundler.setup
Edit this document on GitHub if you caught an error or noticed something was missing.