in Development, Rails

Headless javascript tests with poltergeist and Ubuntu

If you already have a nodejs dependency, I recommend the following solution for headless testing instead of my first one.

Poltergeist needs nodejs and phantomjs to run. There are several ways to install them. I recommend the easiest one: with the built-in package manager. A handy tutorial can be found at BTW: I recommend digging through the tutorial section at digital ocean.

Then add these lines to your Gemfile:

group :development, :test do
  gem 'rspec-rails'
  gem 'capybara'
  gem 'poltergeist'


require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist