Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A really simple example of using webrat and rspec for integration testing
require 'rubygems'
require 'webrat'
require 'spec/test/unit'
include Webrat::Methods
include Webrat::Matchers
Webrat.configure do |config|
config.mode = :mechanize
describe "Google's Privacy" do
it "should discuss transparency" do
visit ""
response = click_link 'Privacy'
response.should contain 'Transparency'
Copy link

wheresalice commented Apr 14, 2010

My initial version was testing assert_contain rather than response.should contain. Whilst this technically saves some coding, it's incorrect behaviour in that assert is too strong a term.

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