Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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