Class: Capybara::RackTest::Driver

Inherits:
Driver::Base show all
Defined in:
lib/capybara/rack_test/driver.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Driver::Base

#evaluate_script, #execute_script, #has_shortcircuit_timeout?, #wait?, #wait_until, #within_frame, #within_window

Constructor Details

#initialize(app, options = {}) ⇒ Driver

Returns a new instance of Driver

Raises:

  • (ArgumentError)


10
11
12
13
14
# File 'lib/capybara/rack_test/driver.rb', line 10

def initialize(app, options={})
  raise ArgumentError, "rack-test requires a rack application, but none was given" unless app
  @app = app
  @options = options
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app



8
9
10
# File 'lib/capybara/rack_test/driver.rb', line 8

def app
  @app
end

#optionsObject (readonly)

Returns the value of attribute options



8
9
10
# File 'lib/capybara/rack_test/driver.rb', line 8

def options
  @options
end

Instance Method Details

#bodyObject



56
57
58
# File 'lib/capybara/rack_test/driver.rb', line 56

def body
  browser.body
end

#browserObject



16
17
18
# File 'lib/capybara/rack_test/driver.rb', line 16

def browser
  @browser ||= Capybara::RackTest::Browser.new(app, options)
end

#current_urlObject



40
41
42
# File 'lib/capybara/rack_test/driver.rb', line 40

def current_url
  browser.current_url
end

#delete(*args, &block) ⇒ Object



75
# File 'lib/capybara/rack_test/driver.rb', line 75

def delete(*args, &block); browser.delete(*args, &block); end

#domObject



64
65
66
# File 'lib/capybara/rack_test/driver.rb', line 64

def dom
  browser.dom
end

#find(selector) ⇒ Object



52
53
54
# File 'lib/capybara/rack_test/driver.rb', line 52

def find(selector)
  browser.find(selector)
end

#follow(method, path, attributes = {}) ⇒ Object



36
37
38
# File 'lib/capybara/rack_test/driver.rb', line 36

def follow(method, path, attributes = {})
  browser.follow(method, path, attributes)
end

#get(*args, &block) ⇒ Object



72
# File 'lib/capybara/rack_test/driver.rb', line 72

def get(*args, &block); browser.get(*args, &block); end

#header(key, value) ⇒ Object



76
# File 'lib/capybara/rack_test/driver.rb', line 76

def header(key, value); browser.header(key, value); end

#post(*args, &block) ⇒ Object



73
# File 'lib/capybara/rack_test/driver.rb', line 73

def post(*args, &block); browser.post(*args, &block); end

#put(*args, &block) ⇒ Object



74
# File 'lib/capybara/rack_test/driver.rb', line 74

def put(*args, &block); browser.put(*args, &block); end

#requestObject



24
25
26
# File 'lib/capybara/rack_test/driver.rb', line 24

def request
  browser.last_request
end

#reset!Object



68
69
70
# File 'lib/capybara/rack_test/driver.rb', line 68

def reset!
  @browser = nil
end

#responseObject



20
21
22
# File 'lib/capybara/rack_test/driver.rb', line 20

def response
  browser.last_response
end

#response_headersObject



44
45
46
# File 'lib/capybara/rack_test/driver.rb', line 44

def response_headers
  response.headers
end

#sourceObject



60
61
62
# File 'lib/capybara/rack_test/driver.rb', line 60

def source
  browser.source
end

#status_codeObject



48
49
50
# File 'lib/capybara/rack_test/driver.rb', line 48

def status_code
  response.status
end

#submit(method, path, attributes) ⇒ Object



32
33
34
# File 'lib/capybara/rack_test/driver.rb', line 32

def submit(method, path, attributes)
  browser.submit(method, path, attributes)
end

#visit(path, attributes = {}) ⇒ Object



28
29
30
# File 'lib/capybara/rack_test/driver.rb', line 28

def visit(path, attributes = {})
  browser.visit(path, attributes)
end