core expects a response so mechanize got one

This commit is contained in:
Jeremy Burks 2008-11-11 20:08:17 -06:00
parent 92fde1d8de
commit a570d40f70

View File

@ -3,17 +3,16 @@ require "mechanize"
module Webrat module Webrat
class MechanizeSession < Session class MechanizeSession < Session
attr_accessor :response
alias :page :response
def initialize(mechanize = WWW::Mechanize.new) def initialize(mechanize = WWW::Mechanize.new)
super() super()
@mechanize = mechanize @mechanize = mechanize
end end
def page
@mechanize_page
end
def get(url, data, headers_argument_not_used = nil) def get(url, data, headers_argument_not_used = nil)
@mechanize_page = @mechanize.get(url, data) @response = @mechanize.get(url, data)
end end
def post(url, data, headers_argument_not_used = nil) def post(url, data, headers_argument_not_used = nil)
@ -26,15 +25,15 @@ module Webrat
end end
memo memo
end end
@mechanize_page = @mechanize.post(url, post_data) @response = @mechanize.post(url, post_data)
end end
def response_body def response_body
@mechanize_page.content @response.content
end end
def response_code def response_code
@mechanize_page.code.to_i @response.code.to_i
end end
end end