Skip to content

Instantly share code, notes, and snippets.

@wheresalice
Created April 14, 2010 13:05
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 wheresalice/365794 to your computer and use it in GitHub Desktop.
Save wheresalice/365794 to your computer and use it in GitHub Desktop.
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

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