Created
April 14, 2010 13:05
-
-
Save wheresalice/365794 to your computer and use it in GitHub Desktop.
A really simple example of using webrat and rspec for integration testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.