Skip to content

Instantly share code, notes, and snippets.

@dustMason
Created September 16, 2012 22:17
Show Gist options
  • Save dustMason/3734614 to your computer and use it in GitHub Desktop.
Save dustMason/3734614 to your computer and use it in GitHub Desktop.
Poltergeist Issue #155
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
# require 'rspec/autorun'
require 'capybara/rails'
require 'capybara/poltergeist'
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, {
# phantomjs_options: ['--cookies-file=/Users/turtle/Desktop/cookies.txt']
})
end
Capybara.javascript_driver = :poltergeist
# Capybara.current_driver = :poltergeist
RSpec.configure do |config|
config.include Devise::TestHelpers, :type => :requests
config.include Warden::Test::Helpers, :type => :requests
config.mock_with :rspec
config.use_transactional_fixtures = false
config.before(:suite) do
DatabaseCleaner.strategy = :truncation
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
# If true, the base class of anonymous controllers will be inferred
# automatically. This will be the default behavior in future versions of
# rspec-rails.
config.infer_base_class_for_anonymous_controllers = false
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = "random"
end
require 'spec_helper'
describe "Shopping Cart Flow" do
before (:each) do
Capybara.current_driver = :poltergeist
@product = FactoryGirl.create(:product)
end
it "should add a product to the cart and indicate that there is an item in the cart" do
visit product_path(@product)
click_on('Add to Cart')
visit root_path # the cart controller does a redirect to cart#show
find('.cart_count').text.should include('1')
end
# other specs here ...
end
GEM
remote: https://rubygems.org/
specs:
actionmailer (3.2.6)
actionpack (= 3.2.6)
mail (~> 2.4.4)
actionpack (3.2.6)
activemodel (= 3.2.6)
activesupport (= 3.2.6)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.1)
rack (~> 1.4.0)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.1.3)
activeadmin (0.5.0)
arbre (>= 1.0.1)
bourbon (>= 1.0.0)
devise (>= 1.1.2)
fastercsv
formtastic (>= 2.0.0)
inherited_resources (>= 1.3.1)
jquery-rails (>= 1.0.0)
kaminari (>= 0.13.0)
meta_search (>= 0.9.2)
rails (>= 3.0.0)
sass (>= 3.1.0)
activemodel (3.2.6)
activesupport (= 3.2.6)
builder (~> 3.0.0)
activerecord (3.2.6)
activemodel (= 3.2.6)
activesupport (= 3.2.6)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.6)
activemodel (= 3.2.6)
activesupport (= 3.2.6)
activesupport (3.2.6)
i18n (~> 0.6)
multi_json (~> 1.0)
addressable (2.3.2)
arbre (1.0.1)
activesupport (>= 3.0.0)
arel (3.0.2)
awesome_print (1.1.0)
bcrypt-ruby (3.0.1)
bourbon (2.1.1)
sass (>= 3.1)
builder (3.0.0)
capybara (1.1.2)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 0.1.4)
childprocess (0.3.5)
ffi (~> 1.0, >= 1.0.6)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.3.3)
database_cleaner (0.8.0)
devise (2.1.2)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.1)
railties (~> 3.1)
warden (~> 1.2.1)
diff-lcs (1.1.3)
email_spec (1.2.1)
mail (~> 2.2)
rspec (~> 2.0)
erubis (2.7.0)
eventmachine (1.0.0)
execjs (1.4.0)
multi_json (~> 1.0)
factory_girl (4.0.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.0.0)
factory_girl (~> 4.0.0)
railties (>= 3.0.0)
faker (1.0.1)
i18n (~> 0.4)
fastercsv (1.5.5)
faye-websocket (0.4.6)
eventmachine (>= 0.12.0)
ffi (1.1.5)
foreman (0.57.0)
thor (>= 0.13.6)
formtastic (2.2.1)
actionpack (>= 3.0)
has_scope (0.5.1)
hashr (0.0.22)
hike (1.2.1)
hominid (3.0.5)
http_parser.rb (0.5.3)
i18n (0.6.1)
inherited_resources (1.3.1)
has_scope (~> 0.5.0)
responders (~> 0.6)
journey (1.0.4)
jquery-rails (2.1.1)
railties (>= 3.1.0, < 5.0)
thor (~> 0.14)
json (1.7.5)
kaminari (0.13.0)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
railties (>= 3.0.0)
kgio (2.7.4)
launchy (2.1.2)
addressable (~> 2.3)
libwebsocket (0.1.5)
addressable
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
meta_search (1.1.3)
actionpack (~> 3.1)
activerecord (~> 3.1)
activesupport (~> 3.1)
polyamorous (~> 0.5.0)
mime-types (1.19)
multi_json (1.0.4)
mysql2 (0.3.11)
nokogiri (1.5.5)
orm_adapter (0.4.0)
poltergeist (0.7.0)
capybara (~> 1.1)
childprocess (~> 0.3)
faye-websocket (~> 0.4, >= 0.4.4)
http_parser.rb (~> 0.5.3)
multi_json (~> 1.0)
polyamorous (0.5.0)
activerecord (~> 3.0)
polyglot (0.3.3)
rabl (0.5.3)
activesupport (>= 2.3.14)
multi_json (~> 1.0.3)
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.2.6)
actionmailer (= 3.2.6)
actionpack (= 3.2.6)
activerecord (= 3.2.6)
activeresource (= 3.2.6)
activesupport (= 3.2.6)
bundler (~> 1.0)
railties (= 3.2.6)
railties (3.2.6)
actionpack (= 3.2.6)
activesupport (= 3.2.6)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
raindrops (0.10.0)
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
responders (0.9.2)
railties (~> 3.1)
rest-client (1.6.7)
mime-types (>= 1.16)
rspec (2.11.0)
rspec-core (~> 2.11.0)
rspec-expectations (~> 2.11.0)
rspec-mocks (~> 2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.2)
diff-lcs (~> 1.1.3)
rspec-mocks (2.11.2)
rspec-rails (2.11.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec (~> 2.11.0)
ruby-progressbar (1.0.1)
rubyzip (0.9.9)
sass (3.2.1)
sass-rails (3.2.5)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
selenium-webdriver (2.25.0)
childprocess (>= 0.2.5)
libwebsocket (~> 0.1.3)
multi_json (~> 1.0)
rubyzip
sequel (3.39.0)
spork (1.0.0rc3)
sprockets (2.1.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.6)
thor (0.16.0)
tilt (1.3.3)
tire (0.4.2)
activemodel (>= 3.0)
hashr (~> 0.0.19)
multi_json (~> 1.0)
rake
rest-client (~> 1.6)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
trollop (2.0)
tzinfo (0.3.33)
uglifier (1.2.4)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
unicorn (4.3.1)
kgio (~> 2.6)
rack
raindrops (~> 0.7)
warden (1.2.1)
rack (>= 1.0)
watchr (0.7)
xpath (0.1.4)
nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
activeadmin (= 0.5.0)
awesome_print
capybara (>= 1.1.2)
coffee-rails (~> 3.2.1)
database_cleaner
devise (>= 2.1.2)
email_spec (>= 1.2.1)
factory_girl_rails (>= 4.0.0)
faker
foreman
hominid (>= 3.0.5)
jquery-rails
kaminari
launchy
mysql2
poltergeist
rabl
rails (= 3.2.6)
rspec-rails (>= 2.11.0)
ruby-progressbar
sass-rails (~> 3.2.3)
sequel
spork (~> 1.0rc)
sqlite3
tire
trollop
uglifier (>= 1.0.3)
unicorn
watchr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment