Class: Webrat::MerbSession
- Inherits:
-
Session
show all
- Includes:
- Merb::Test::MakeRequest
- Defined in:
- lib/webrat/merb_session.rb
Overview
Instance Attribute Summary collapse
Attributes inherited from Session
#current_url, #elements
Instance Method Summary
collapse
-
#delete(url, data, headers = nil) ⇒ Object
-
#do_request(url, data, headers, method) ⇒ Object
-
#get(url, data, headers = nil) ⇒ Object
-
#post(url, data, headers = nil) ⇒ Object
-
#put(url, data, headers = nil) ⇒ Object
-
#response_body ⇒ Object
-
#response_code ⇒ Object
Methods inherited from Session
#automate, #basic_auth, #check_for_infinite_redirects, #click_link_within, #current_dom, #current_page, #current_scope, #doc_root, #dom, #exception_caught?, #formatted_error, #header, #headers, #http_accept, #infinite_redirect_limit_exceeded?, #initialize, #internal_redirect?, #page_scope, #redirect?, #redirected_to, #reload, #request_page, #scopes, #simulate, #success_code?, #visit, #within, #xml_content_type?
#doc_root, #open_in_browser, #rewrite_css_and_image_references, #save_and_open_page, #saved_page_dir
Methods included from Logging
#debug_log, #logger
Instance Attribute Details
Returns the value of attribute response.
14
15
16
|
# File 'lib/webrat/merb_session.rb', line 14
def response
@response
end
|
Instance Method Details
#delete(url, data, headers = nil) ⇒ Object
28
29
30
|
# File 'lib/webrat/merb_session.rb', line 28
def delete(url, data, = nil)
do_request(url, data, , "DELETE")
end
|
#do_request(url, data, headers, method) ⇒ Object
40
41
42
43
44
45
|
# File 'lib/webrat/merb_session.rb', line 40
def do_request(url, data, , method)
@response = request(url,
:params => (data && data.any?) ? data : nil,
:headers => ,
:method => method)
end
|
#get(url, data, headers = nil) ⇒ Object
16
17
18
|
# File 'lib/webrat/merb_session.rb', line 16
def get(url, data, = nil)
do_request(url, data, , "GET")
end
|
#post(url, data, headers = nil) ⇒ Object
20
21
22
|
# File 'lib/webrat/merb_session.rb', line 20
def post(url, data, = nil)
do_request(url, data, , "POST")
end
|
#put(url, data, headers = nil) ⇒ Object
24
25
26
|
# File 'lib/webrat/merb_session.rb', line 24
def put(url, data, = nil)
do_request(url, data, , "PUT")
end
|
#response_body ⇒ Object
32
33
34
|
# File 'lib/webrat/merb_session.rb', line 32
def response_body
@response.body.to_s
end
|
#response_code ⇒ Object
36
37
38
|
# File 'lib/webrat/merb_session.rb', line 36
def response_code
@response.status
end
|