Class: Webrat::RailsSession

Inherits:
Session show all
Defined in:
lib/webrat/rails.rb

Overview

:nodoc:

Instance Attribute Summary

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, #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, #scopes, #simulate, #success_code?, #visit, #within

Methods included from Logging

#debug_log, #logger

Constructor Details

This class inherits a constructor from Webrat::Session

Instance Method Details

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



27
28
29
# File 'lib/webrat/rails.rb', line 27

def delete(url, data, headers = nil)
  do_request(:delete, url, data, headers)
end

#doc_rootObject



7
8
9
# File 'lib/webrat/rails.rb', line 7

def doc_root
  File.expand_path(File.join(RAILS_ROOT, 'public'))
end

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



15
16
17
# File 'lib/webrat/rails.rb', line 15

def get(url, data, headers = nil)
  do_request(:get, url, data, headers)
end

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



19
20
21
# File 'lib/webrat/rails.rb', line 19

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

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



23
24
25
# File 'lib/webrat/rails.rb', line 23

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

#response_bodyObject



31
32
33
# File 'lib/webrat/rails.rb', line 31

def response_body
  response.body
end

#response_codeObject



35
36
37
# File 'lib/webrat/rails.rb', line 35

def response_code
  response.code.to_i
end

#saved_page_dirObject



11
12
13
# File 'lib/webrat/rails.rb', line 11

def saved_page_dir
  File.expand_path(File.join(RAILS_ROOT, "tmp"))
end

#xml_content_type?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/webrat/rails.rb', line 39

def xml_content_type?
  response.headers["Content-Type"].to_s =~ /xml/
end