Class: Capybara::RackTest::Driver
- Inherits:
-
Driver::Base
show all
- Defined in:
- lib/capybara/rack_test/driver.rb
Constant Summary
- DEFAULT_OPTIONS =
{
:respect_data_method => false,
:follow_redirects => true,
:redirect_limit => 5
}
Instance Attribute Summary (collapse)
Instance Method Summary
(collapse)
-
- (Object) browser
-
- (Object) current_url
-
- (Object) delete(*args, &block)
-
- (Object) dom
-
- (Object) find_css(selector)
-
- (Object) find_xpath(selector)
-
- (Object) follow(method, path, attributes = {})
-
- (Boolean) follow_redirects?
-
- (Object) get(*args, &block)
-
- (Object) header(key, value)
-
- (Object) html
-
- (Driver) initialize(app, options = {})
constructor
A new instance of Driver.
-
- (Object) post(*args, &block)
-
- (Object) put(*args, &block)
-
- (Object) redirect_limit
-
- (Object) request
-
- (Object) reset!
-
- (Object) response
-
- (Object) response_headers
-
- (Object) status_code
-
- (Object) submit(method, path, attributes)
-
- (Object) title
-
- (Object) visit(path, attributes = {})
#evaluate_script, #execute_script, #invalid_element_errors, #needs_server?, #save_screenshot, #wait?, #within_frame, #within_window
Constructor Details
- (Driver) initialize(app, options = {})
15
16
17
18
19
|
# File 'lib/capybara/rack_test/driver.rb', line 15
def initialize(app, options={})
raise ArgumentError, "rack-test requires a rack application, but none was given" unless app
@app = app
@options = DEFAULT_OPTIONS.merge(options)
end
|
Instance Attribute Details
- (Object) app
Returns the value of attribute app
13
14
15
|
# File 'lib/capybara/rack_test/driver.rb', line 13
def app
@app
end
|
- (Object) options
Returns the value of attribute options
13
14
15
|
# File 'lib/capybara/rack_test/driver.rb', line 13
def options
@options
end
|
Instance Method Details
- (Object) browser
21
22
23
|
# File 'lib/capybara/rack_test/driver.rb', line 21
def browser
@browser ||= Capybara::RackTest::Browser.new(self)
end
|
- (Object) current_url
53
54
55
|
# File 'lib/capybara/rack_test/driver.rb', line 53
def current_url
browser.current_url
end
|
- (Object) delete(*args, &block)
92
|
# File 'lib/capybara/rack_test/driver.rb', line 92
def delete(*args, &block); browser.delete(*args, &block); end
|
- (Object) dom
77
78
79
|
# File 'lib/capybara/rack_test/driver.rb', line 77
def dom
browser.dom
end
|
- (Object) find_css(selector)
69
70
71
|
# File 'lib/capybara/rack_test/driver.rb', line 69
def find_css(selector)
browser.find(:css,selector)
end
|
- (Object) find_xpath(selector)
65
66
67
|
# File 'lib/capybara/rack_test/driver.rb', line 65
def find_xpath(selector)
browser.find(:xpath, selector)
end
|
- (Object) follow(method, path, attributes = {})
49
50
51
|
# File 'lib/capybara/rack_test/driver.rb', line 49
def follow(method, path, attributes = {})
browser.follow(method, path, attributes)
end
|
- (Boolean) follow_redirects?
25
26
27
|
# File 'lib/capybara/rack_test/driver.rb', line 25
def follow_redirects?
@options[:follow_redirects]
end
|
- (Object) get(*args, &block)
89
|
# File 'lib/capybara/rack_test/driver.rb', line 89
def get(*args, &block); browser.get(*args, &block); end
|
93
|
# File 'lib/capybara/rack_test/driver.rb', line 93
def (key, value); browser.(key, value); end
|
- (Object) html
73
74
75
|
# File 'lib/capybara/rack_test/driver.rb', line 73
def html
browser.html
end
|
- (Object) post(*args, &block)
90
|
# File 'lib/capybara/rack_test/driver.rb', line 90
def post(*args, &block); browser.post(*args, &block); end
|
- (Object) put(*args, &block)
91
|
# File 'lib/capybara/rack_test/driver.rb', line 91
def put(*args, &block); browser.put(*args, &block); end
|
- (Object) redirect_limit
29
30
31
|
# File 'lib/capybara/rack_test/driver.rb', line 29
def redirect_limit
@options[:redirect_limit]
end
|
- (Object) request
37
38
39
|
# File 'lib/capybara/rack_test/driver.rb', line 37
def request
browser.last_request
end
|
- (Object) reset!
85
86
87
|
# File 'lib/capybara/rack_test/driver.rb', line 85
def reset!
@browser = nil
end
|
- (Object) response
33
34
35
|
# File 'lib/capybara/rack_test/driver.rb', line 33
def response
browser.last_response
end
|
57
58
59
|
# File 'lib/capybara/rack_test/driver.rb', line 57
def
response.
end
|
- (Object) status_code
61
62
63
|
# File 'lib/capybara/rack_test/driver.rb', line 61
def status_code
response.status
end
|
- (Object) submit(method, path, attributes)
45
46
47
|
# File 'lib/capybara/rack_test/driver.rb', line 45
def submit(method, path, attributes)
browser.submit(method, path, attributes)
end
|
- (Object) title
81
82
83
|
# File 'lib/capybara/rack_test/driver.rb', line 81
def title
browser.title
end
|
- (Object) visit(path, attributes = {})
41
42
43
|
# File 'lib/capybara/rack_test/driver.rb', line 41
def visit(path, attributes = {})
browser.visit(path, attributes)
end
|