Get Integrity to Play Well With Rails 3 and Bundler 1.0

The latest “stable” version of Integrity (v22) doesn’t play well with Rails 3 (or any other application using bundler 1.0). Basically the Integrity’s Gemfile is used in place of the application’s Gemfile when running the tests.

With a Rails 3 application you are likely to get:

no such file to load -- rails/all

Integrity fails to run with Rails 3 and Bundler 1.0

A patched version of integrity v22 for bundler 1.0 is available on http://github.com/pcreux/integrity/tree/v22-bundler-1.0.0.rc.

You also need to force your Rails application to use its Gemfile. To do so, update the file /config/boot.rb with the following:

1
2
3
4
5
6
7
8
9
require 'rubygems'
# Set up gems listed in the Gemfile.
GEMFILE_PATH = File.expand_path('../../Gemfile', __FILE__)
if File.exist?(GEMFILE_PATH)
  # Force the rails 3 application to use its Gemfile
  ENV['BUNDLE_GEMFILE'] = GEMFILE_PATH
  require 'bundler'
  Bundler.setup
end

That should make the trick!

Patched Integrity and custom boot.rb makes integrity working with Rails 3

Comments