Navigation Menu

Skip to content
This repository has been archived by the owner on Oct 18, 2018. It is now read-only.

Commit

Permalink
Get cucumber JS tests working on vagrant
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Lorente authored and shawnacscott committed Sep 15, 2013
1 parent 1418c62 commit 032165d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Vagrantfile
Expand Up @@ -13,7 +13,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"

config.vm.provision :shell, :path => "bootstrap.sh"
config.vm.provision :shell, :path => "vagrant/bootstrap.sh"

# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
Expand Down
5 changes: 4 additions & 1 deletion features/step_definitions/login_steps.rb
Expand Up @@ -29,7 +29,10 @@
begin
page.should have_content(text)
rescue
save_and_open_page
begin
save_and_open_page
rescue Launchy::CommandNotFoundError
end
raise
end
end
Expand Down
11 changes: 8 additions & 3 deletions bootstrap.sh → vagrant/bootstrap.sh
Expand Up @@ -3,12 +3,12 @@
set -e

apt-get update
apt-get install -y git curl postgresql libpq-dev
apt-get install -y git curl postgresql libpq-dev dbus-x11 firefox xvfb

curl -L https://get.rvm.io | sudo -u vagrant HOME=/home/vagrant bash -s stable
echo 'source ~vagrant/.rvm/scripts/rvm && rvm use --install --default 1.9.3' | sudo -u vagrant bash
echo 'source ~/.rvm/scripts/rvm' >> ~vagrant/.bashrc
echo 'rvm use 1.9.3' >> ~vagrant/.bashrc
echo 'source ~/.rvm/scripts/rvm' >> ~vagrant/.bash_profile
echo 'rvm use 1.9.3' >> ~vagrant/.bash_profile

sudo -u postgres psql postgres -c 'create role vagrant with login createdb'
sudo -u postgres psql postgres -c 'create database green_mercury owner vagrant'
Expand All @@ -21,3 +21,8 @@ ln -s /vagrant ~vagrant/green_mercury
cd ~vagrant/green_mercury
echo 'source ~vagrant/.rvm/scripts/rvm && bundle install' | sudo -u vagrant bash
cd -

echo 'export DISPLAY=:99' >> ~vagrant/.bash_profile
cp /vagrant/vagrant/xvfb.init-script /etc/init.d/xvfb
chmod 755 /etc/init.d/xvfb
service xvfb start
16 changes: 16 additions & 0 deletions vagrant/xvfb.init-script
@@ -0,0 +1,16 @@
#!/bin/bash

if [ -z "$1" ]; then
echo "`basename $0` {start|stop}"
exit
fi

case "$1" in
start)
/usr/bin/Xvfb :99 -ac -screen 0 1024x768x8 &
;;

stop)
killall Xvfb
;;
esac

0 comments on commit 032165d

Please sign in to comment.