Normalize access to response headers in adapters
This commit is contained in:
parent
56b2f342da
commit
67febe9072
@ -39,6 +39,10 @@ module Webrat #:nodoc:
|
||||
@response.code.to_i
|
||||
end
|
||||
|
||||
def response_headers
|
||||
@response.header
|
||||
end
|
||||
|
||||
def mechanize
|
||||
unless @mechanize
|
||||
@mechanize = Mechanize.new
|
||||
|
@ -18,6 +18,10 @@ module Webrat
|
||||
response.status
|
||||
end
|
||||
|
||||
def response_headers
|
||||
response.headers
|
||||
end
|
||||
|
||||
def response
|
||||
@session.last_response
|
||||
end
|
||||
|
@ -35,6 +35,10 @@ module Webrat
|
||||
response.code.to_i
|
||||
end
|
||||
|
||||
def response_headers
|
||||
response.headers
|
||||
end
|
||||
|
||||
def xml_content_type?
|
||||
response.headers["Content-Type"].to_s =~ /xml/
|
||||
end
|
||||
|
@ -281,7 +281,7 @@ For example:
|
||||
end
|
||||
|
||||
def response_location
|
||||
response.headers["Location"]
|
||||
response_headers['Location']
|
||||
end
|
||||
|
||||
def current_host
|
||||
|
@ -78,4 +78,16 @@ describe Webrat::MechanizeAdapter do
|
||||
@session.absolute_url(relative_url).should == 'https://test.host/wilma'
|
||||
end
|
||||
end
|
||||
|
||||
describe "response_headers" do
|
||||
it "should return the Headers object from the response" do
|
||||
mech = @mech.mechanize
|
||||
resp = mock('Mechanize::File')
|
||||
hdr = Mechanize::Headers.new
|
||||
resp.should_receive(:header).and_return(hdr)
|
||||
mech.stub!(:get).and_return(resp)
|
||||
@mech.get('/', nil)
|
||||
@mech.response_headers.should == hdr
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user