Class: Webrat::MerbSession

Inherits:
Session show all
Includes:
Merb::Test::MakeRequest
Defined in:
lib/webrat/merb_session.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Attributes inherited from Session

#current_url, #elements

Instance Method Summary collapse

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?

Methods included from SaveAndOpenPage

#doc_root, #open_in_browser, #rewrite_css_and_image_references, #save_and_open_page, #saved_page_dir

Methods included from Logging

#debug_log, #logger

Constructor Details

This class inherits a constructor from Webrat::Session

Instance Attribute Details

#responseObject

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, headers = nil)
  do_request(url, data, headers, "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, headers, method)
  @response = request(url,
    :params => (data && data.any?) ? data : nil,
    :headers => 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, headers = nil)
  do_request(url, data, headers, "GET")
end

#post(url, data, headers = nil) ⇒ Object



20
21
22
# File 'lib/webrat/merb_session.rb', line 20

def post(url, data, headers = nil)
  do_request(url, data, headers, "POST")
end

#put(url, data, headers = nil) ⇒ Object



24
25
26
# File 'lib/webrat/merb_session.rb', line 24

def put(url, data, headers = nil)
  do_request(url, data, headers, "PUT")
end

#response_bodyObject



32
33
34
# File 'lib/webrat/merb_session.rb', line 32

def response_body
  @response.body.to_s
end

#response_codeObject



36
37
38
# File 'lib/webrat/merb_session.rb', line 36

def response_code
  @response.status
end