Using Capybara with RSpec Outside Cucumber

If you want to try using Capybara for browser automation on it’s own, here’s a simple script to get you started: require ‘rubygems’ require ‘capybara’ require ‘capybara/dsl’ Capybara.default_driver = :selenium Capybara.app_host = “http://www.google.com” require “rspec/expectations” class Google include Capybara include RSpec::Matchers def search_for(text) visit “/” fill_in “q”, :with => text click_button “Search” end def ensure_results_contain(expected_text) …