Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ikbear/402117 to your computer and use it in GitHub Desktop.
Save ikbear/402117 to your computer and use it in GitHub Desktop.
# These commands will help you setup the Rails test environment without problems
#
# MAKE SURE YOU HAVE VIRTUAL BOX INSTALLED http://www.virtualbox.org/wiki/Downloads
#
# Copy paste all of following commands in your normal terminal and the following things will happen:
# - rails_test_box dir is created
# - rails master branch is checkout in the dir rails
# - A Gemfile is created and all the gems to run the virtualbox are installed using bundler
# - The rails vagrant box is downloaded and added to your vagrant boxes
# - A Vagrantfile is created for vagrant
# - The rails box will be activated, meaning it will be copied from your vagrant boxes directory and started
# - The 'vagrant ssh' makes you go into the box from now on all the commands are in the virtualbox until you type 'exit'
gem install bundler
mkdir rails_test_box
cd rails_test_box
git clone git://github.com/rails/rails.git
echo 'source :rubygems
group :virtualbox do
gem "vagrant", "0.3.0"
gem "virtualbox", "0.6.0"
end' > Gemfile
bundle install
bundle exec vagrant box add rails_test_box http://files.cookiestack.com/rails_test_env.box
echo 'Vagrant::Config.run do |config|
config.vm.share_folder("rails", "rails", "rails")
config.vm.box = "rails_test_box"
end' > Vagrantfile
bundle exec vagrant up
bundle exec vagrant ssh
# Now you are in the Virtualbox. Start running the tests!
cd rails
bundle install
rake
# To run the tests for 1.9.1-p376 do the following in the VirtualBox
# If you have logged out, you can log into the box again with 'vagrant ssh'
# (The bundle install only needs to be run the first time)
cd ~/rails
rvm 1.9.1-p376
bundle install
rake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment