Skip to content

Instantly share code, notes, and snippets.

Embed
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
end
describe "Google's Privacy" do
it "should discuss transparency" do
visit "http://www.google.com"
response = click_link 'Privacy'
response.should contain 'Transparency'
end
end
@wheresalice
Copy link
Author

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