Skip to content

Instantly share code, notes, and snippets.

@hawx
Created September 21, 2011 17:02
Show Gist options
  • Save hawx/1232660 to your computer and use it in GitHub Desktop.
Save hawx/1232660 to your computer and use it in GitHub Desktop.
Run tests for all installed versions of ruby under rbenv

This took a while for me to work out, but essentially you need to remember two things:

  1. everything that needs to be prefixed with rbenv exec
  2. and everything that can be needs to be prefixed with bundle exec as well

The downside to this is that you need to add rake to your Gemfile. Just running rbenv exec rake will not work, for some reason.

desc 'Run tests on for all versions of ruby'
task :test_all do
`rbenv versions --bare`.split("\n").each do |vers|
run_for vers, ['bundle install', 'bundle exec rake']
end
end
def run_for(vers, commands)
system "RBENV_VERSION='#{vers}' sh -c '#{commands.map {|i| "rbenv exec #{i}"}.join(' && ')}'"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment