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" | |
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