Ubuntu 12.04 phantomjs installation

Visit PhantomJS site, go to download page and copy link address for Linux, in our case this is https://phantomjs.googlecode.com/files/phantomjs-1.9.2-linux-x86_64.tar.bz2

Then go to console and run following commands:

sudo apt-get install libfontconfig libfontconfig-dev libfreetype6-dev

^
wget https://phantomjs.googlecode.com/files/phantomjs-1.9.2-linux-x86_64.tar.bz2
^
sudo mv phantomjs-1.9.2-linux-x86_64.tar.bz2 /opt
^
cd /opt
^
tar -xvf phantomjs-1.9.2-linux-x86_64.tar.bz2
^
ln -s /opt/phantomjs-1.9.2-linux-x8...

Rspec + Capybara + Rails4 + Spork (intergation tests setup with selenium and poltergeist)

Add in Gemfile:

group :development, :test do
  gem 'rspec-rails'
  gem 'spork-rails'
end

group :test do
  gem 'capybara'
  gem 'database_cleaner'
  gem 'email_spec'
  gem 'poltergeist'
  gem 'launchy'
  gem 'selenium-webdriver'
end

Run bundle install

Ensure your spec_helper.rb looks similar with this:

require 'rubygems'
require 'spork'
#uncomment the following line to use spork with the debugger
# require 'spork/ext/ruby-debug'

Spork.prefork do
  # Loading more in this block will cause your tests to ...