Class: Webrat::SinatraSession

Inherits:
RackSession show all
Includes:
Sinatra::Test
Defined in:
lib/webrat/sinatra.rb

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?, #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

#initialize(context = nil) ⇒ SinatraSession

Returns a new instance of SinatraSession.



10
11
12
13
14
15
16
# File 'lib/webrat/sinatra.rb', line 10

def initialize(context = nil)
  super(context)

  app = context.respond_to?(:app) ? context.app : Sinatra::Application
  @browser = Sinatra::TestHarness.new(app)
  @cookies = []
end

Instance Attribute Details

#requestObject (readonly)

Returns the value of attribute request.



8
9
10
# File 'lib/webrat/sinatra.rb', line 8

def request
  @request
end

Instance Method Details

#response_bodyObject



33
34
35
# File 'lib/webrat/sinatra.rb', line 33

def response_body
  @browser.body
end

#response_codeObject



37
38
39
# File 'lib/webrat/sinatra.rb', line 37

def response_code
  @browser.status
end