Class: Webrat::MechanizeSession
Overview
Instance Attribute Summary collapse
Attributes inherited from Session
#current_url, #elements
Instance Method Summary
collapse
Methods inherited from Session
#automate, #basic_auth, #click_link_within, #current_dom, #current_page, #current_scope, #doc_root, #dom, #exception_caught?, #formatted_error, #header, #headers, #http_accept, #initialize, #open_in_browser, #page_scope, #reloads, #request_page, #rewrite_css_and_image_references, #save_and_open_page, #saved_page_dir, #scopes, #simulate, #success_code?, #visit, #within, #xml_content_type?
Methods included from Logging
#debug_log, #logger
Instance Attribute Details
#response ⇒ Object
Also known as:
page
Returns the value of attribute response.
6
7
8
|
# File 'lib/webrat/mechanize.rb', line 6
def response
@response
end
|
Instance Method Details
#get(url, data, headers_argument_not_used = nil) ⇒ Object
9
10
11
|
# File 'lib/webrat/mechanize.rb', line 9
def get(url, data, = nil)
@response = mechanize.get(url, data)
end
|
#mechanize ⇒ Object
34
35
36
|
# File 'lib/webrat/mechanize.rb', line 34
def mechanize
@mechanize = WWW::Mechanize.new
end
|
#post(url, data, headers_argument_not_used = nil) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/webrat/mechanize.rb', line 13
def post(url, data, = nil)
post_data = data.inject({}) do |memo, param|
case param.last
when Hash
param.last.each {|attribute, value| memo["#{param.first}[#{attribute}]"] = value }
else
memo[param.first] = param.last
end
memo
end
@response = mechanize.post(url, post_data)
end
|
#response_body ⇒ Object
26
27
28
|
# File 'lib/webrat/mechanize.rb', line 26
def response_body
@response.content
end
|
#response_code ⇒ Object
30
31
32
|
# File 'lib/webrat/mechanize.rb', line 30
def response_code
@response.code.to_i
end
|