Travis has a great feature of being able to install gems using a custom Gemfile path. This lets you do things like test against multiple versions of Rails very easily. A project that uses this is sprockets-rails.

I wasn’t sure how to bundle install that gemfile locally, it turns out bundler has a BUNDLE_GEMFILE environment variable you can use to point to a specific Gemfile. You can bundle install:

~/documents/projects/sprockets-rails
$ BUNDLE_GEMFILE=test/gemfiles/Gemfile.rails-3.0.x bundle install

Then you can Run your tests:

$ BUNDLE_GEMFILE=test/gemfiles/Gemfile.rails-3.0.x bundle exec rake test