Using mechanize is easy, just make World be a MechanizeAdapter (renamed from MechanizeSession in e4ea9134a72191c70d37205d8d4533cbc894154e ) with the matchers you want mixed in.
Don’t forget to change your visit argument to point to a fully qualified server you want to hit, and make sure that the server is actually running (e.g. something on localhost on a certain port).
require 'webrat' Webrat.configure do |config| config.mode = :mechanize end class MechanizeWorld < Webrat::MechanizeAdapter include Webrat::Matchers include Webrat::Methods # no idea why we need this but without it response_code is not always recognized Webrat::Methods.delegate_to_session :response_code, :response_body # this is needed for webrat_steps.rb Webrat::Methods.delegate_to_session :response end World do MechanizeWorld.new end
2011/02: The “World do” construct has been replaced by “World(MyModuleThatDoesIt)”