PhantomJS is an awesome tool for doing automated, full-stack acceptance tests in a headless browser. It's a great alternative to capybara-webkit because it doesn't depend on QT or xvfb, and it's way better than Selenium in most cases because it's faster (you don't need to open Firefox to run your tests).
Unfortunately, installing PhantomJS via Homebrew can wreak havoc on your Rubies if you're using rbenv. These are the steps that worked for me in fixing my Ruby installations.
# Update Homebrew
brew update
# Install PhantomJS
brew install phantomjs
IMPORTANT: Watch the installation output. If homebrew installs a new version of openssl, you will need to continue with the instructions below. If openssl isn't mentioned during installation, then you should be good to go.
You'll know for sure if you need to follow these instructions if you start getting errors like Ruby Bundle Symbol not found: _SSLv2_client_method (LoadError)
when trying to bundle install
, bundle exec foreman start
, etc.
# Uninstall the version of Ruby you're using (you may need to do this for several versions)
rbenv uninstall 2.1.2
# Re-install the version you need (takes some time...~5-10 minutes on a decent laptop)
rbenv install 2.1.2
# Install bundler if it wasn't installed automatically (you'd see it in the output from
# rbenv install...
gem install bundler
rbenv rehash