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

- (Driver) initialize(app, options = {})

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

- (Object) app (readonly)

Returns the value of attribute app



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

def app
  @app
end

- (Object) options (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

- (Object) body



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

def body
  browser.body
end

- (Object) browser



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

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

- (Object) current_url



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

def current_url
  browser.current_url
end

- (Object) delete(*args, &block)



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

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

- (Object) dom



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

def dom
  browser.dom
end

- (Object) find(selector)



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

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

- (Object) follow(method, path, attributes = {})



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

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

- (Object) get(*args, &block)



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

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

- (Object) header(key, value)



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

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

- (Object) post(*args, &block)



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

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

- (Object) put(*args, &block)



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

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

- (Object) request



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

def request
  browser.last_request
end

- (Object) reset!



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

def reset!
  @browser = nil
end

- (Object) response



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

def response
  browser.last_response
end

- (Object) response_headers



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

def response_headers
  response.headers
end

- (Object) source



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

def source
  browser.source
end

- (Object) status_code



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

def status_code
  response.status
end

- (Object) submit(method, path, attributes)



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

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

- (Object) visit(path, attributes = {})



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

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