Skip to content

Instantly share code, notes, and snippets.

@joshuasiler
Created April 13, 2012 18:47
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 joshuasiler/2379135 to your computer and use it in GitHub Desktop.
Save joshuasiler/2379135 to your computer and use it in GitHub Desktop.
Jenkins shell script to run headless rails tests
# loads RVM into current shell for correct ruby and gem environment
source /etc/profile.d/rvm.sh
# source the .rvmrc file in the project
cd .
# instantiates an Xvfb session on display port 99
Xvfb :99 -ac &
# environment variable to let firefox know where to run
export DISPLAY=:99
# run tests with a custom rake task to fire up Capybara and Selenium Web driver
rake test:browser
# Jenkins will pass or fail this script based on the final return value, so I am saving the return value for later use
set $STATUS = $?
# end Xvfb session
killall Xvfb
# let Jenkins know how the tests went
exit $STATUS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment