Skip to content

Instantly share code, notes, and snippets.

@pathsny
Created April 24, 2010 13:16
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 pathsny/377645 to your computer and use it in GitHub Desktop.
Save pathsny/377645 to your computer and use it in GitHub Desktop.
require "rubygems"
require "webrat"
Webrat.configure do |config|
config.mode = :mechanize
end
class Webrat::Session
def_delegators :@adapter, :response_headers
def response_location
response_headers['Location']
end
end
class Webrat::MechanizeAdapter
def response_headers
@response.header
end
def mechanize
@mechanize ||= begin
mechanize = Mechanize.new
mechanize.redirect_ok = false
mechanize
end
end
end
include Webrat::Methods
visit "http://localhost:4567/hi"
click_button "submit"
puts current_url
puts response_body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment