Skip to content

Instantly share code, notes, and snippets.

@JoshCheek
Created May 4, 2014 19:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoshCheek/a906099d3780f81317ec to your computer and use it in GitHub Desktop.
Save JoshCheek/a906099d3780f81317ec to your computer and use it in GitHub Desktop.
Using poltergeist to navigate the web.
require 'capybara/rspec'
require 'capybara/poltergeist'
Capybara.javascript_driver = Capybara.current_driver = :poltergeist
describe 'google.com', type: :feature do
specify "I can search for and find testdouble's website" do
page.visit 'http://duckduckgo.com/'
page.fill_in 'q', with: 'test double'
page.click_on 'search_button_homepage'
page.click_link "Test Double | Custom Software Development | Columbus Ohio"
sleep 2 # <-- that's lame, maybe something in Capybara talks about this more
expect(page.body).to include "We're Test Double"
end
end
@JoshCheek
Copy link
Author

Assumes:

  • You have phantom installed (brew install phantom)
  • gems for
    • capybara (mine had version 2.2.1)
    • poltergeist (mine had version 1.5.0)
    • rspec (mine had version 2.14.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment