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 https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-an-ubuntu-14-04-server. 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' end
/spec/rails_helper.rb
... require 'capybara/poltergeist' ... Capybara.javascript_driver = :poltergeist ...
I never had to install nodejs to use poltergeist. Are you really sure it’s needed?
I installed phantomjs with npm, which needs nodejs to run.
I’m not a fan of this ‘just put the bin-dir in your path’ approach.