Class: Capybara::RackTest::Driver
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Driver::Base
|
|
Instance Chain:
self,
Driver::Base
|
|
Inherits: |
Capybara::Driver::Base
|
Defined in: | lib/capybara/rack_test/driver.rb |
Constant Summary
-
DEFAULT_OPTIONS =
# File 'lib/capybara/rack_test/driver.rb', line 10{ respect_data_method: false, follow_redirects: true, redirect_limit: 5 }.freeze
Class Method Summary
- .new(app, **options) ⇒ Driver constructor
Instance Attribute Summary
- #app readonly
- #follow_redirects? ⇒ Boolean readonly
- #options readonly
Driver::Base
- Inherited
Instance Method Summary
- #browser
- #current_url
- #delete
- #dom
- #find_css(selector)
- #find_xpath(selector)
- #follow(method, path, **attributes)
- #get
- #header(key, value)
- #html
- #invalid_element_errors
- #post
- #put
- #redirect_limit
- #refresh
- #request
- #reset!
- #response
- #response_headers
- #status_code
- #submit(method, path, attributes)
- #title
- #visit(path, **attributes)
Driver::Base
- Inherited
#accept_modal | Execute the block, and then accept the modal opened. |
#active_element, #close_window, #current_url, #current_window_handle, | |
#dismiss_modal | Execute the block, and then dismiss the modal opened. |
#evaluate_async_script, #evaluate_script, #execute_script, #find_css, #find_xpath, #frame_title, #frame_url, #fullscreen_window, #go_back, #go_forward, #html, #invalid_element_errors, #maximize_window, #no_such_window_error, #open_new_window, #refresh, #reset!, #resize_window_to, #response_headers, #save_screenshot, #send_keys, #session_options, #status_code, #switch_to_frame, #switch_to_window, #visit, #window_handles, #window_size |
Constructor Details
.new(app, **options) ⇒ Driver
# File 'lib/capybara/rack_test/driver.rb', line 17
def initialize(app, ** ) raise ArgumentError, 'rack-test requires a rack application, but none was given' unless app super() @app = app @options = DEFAULT_OPTIONS.merge( ) end
Instance Attribute Details
#app (readonly)
[ GitHub ]# File 'lib/capybara/rack_test/driver.rb', line 15
attr_reader :app, :
#follow_redirects? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/capybara/rack_test/driver.rb', line 29
def follow_redirects? @options[:follow_redirects] end
#options (readonly)
[ GitHub ]# File 'lib/capybara/rack_test/driver.rb', line 15
attr_reader :app, :
Instance Method Details
#browser
[ GitHub ]#current_url
[ GitHub ]# File 'lib/capybara/rack_test/driver.rb', line 61
def current_url browser.current_url end
#delete
[ GitHub ]# File 'lib/capybara/rack_test/driver.rb', line 104
def delete(...); browser.delete(...); end
#dom
[ GitHub ]# File 'lib/capybara/rack_test/driver.rb', line 89
def dom browser.dom end
#find_css(selector)
[ GitHub ]# File 'lib/capybara/rack_test/driver.rb', line 77
def find_css(selector) browser.find(:css, selector) rescue Nokogiri::CSS::SyntaxError raise unless selector.include?(' i]') raise ArgumentError, "This driver doesn't support case insensitive attribute matching when using CSS base selectors" end
#find_xpath(selector)
[ GitHub ]# File 'lib/capybara/rack_test/driver.rb', line 73
def find_xpath(selector) browser.find(:xpath, selector) end
#follow(method, path, **attributes)
[ GitHub ]# File 'lib/capybara/rack_test/driver.rb', line 57
def follow(method, path, **attributes) browser.follow(method, path, attributes) end
#get
[ GitHub ]# File 'lib/capybara/rack_test/driver.rb', line 101
def get(...); browser.get(...); end
#header(key, value)
[ GitHub ]# File 'lib/capybara/rack_test/driver.rb', line 105
def header(key, value); browser.header(key, value); end
#html
[ GitHub ]# File 'lib/capybara/rack_test/driver.rb', line 85
def html browser.html end
#invalid_element_errors
[ GitHub ]# File 'lib/capybara/rack_test/driver.rb', line 107
def invalid_element_errors [Capybara::RackTest::Errors::StaleElementReferenceError] end
#post
[ GitHub ]# File 'lib/capybara/rack_test/driver.rb', line 102
def post(...); browser.post(...); end
#put
[ GitHub ]# File 'lib/capybara/rack_test/driver.rb', line 103
def put(...); browser.put(...); end
#redirect_limit
[ GitHub ]# File 'lib/capybara/rack_test/driver.rb', line 33
def redirect_limit @options[:redirect_limit] end
#refresh
[ GitHub ]# File 'lib/capybara/rack_test/driver.rb', line 49
def refresh browser.refresh end
#request
[ GitHub ]# File 'lib/capybara/rack_test/driver.rb', line 41
def request browser.last_request end
#reset!
[ GitHub ]# File 'lib/capybara/rack_test/driver.rb', line 97
def reset! @browser = nil end
#response
[ GitHub ]# File 'lib/capybara/rack_test/driver.rb', line 37
def response browser.last_response end
#response_headers
[ GitHub ]# File 'lib/capybara/rack_test/driver.rb', line 65
def response_headers response.headers end
#status_code
[ GitHub ]# File 'lib/capybara/rack_test/driver.rb', line 69
def status_code response.status end
#submit(method, path, attributes)
[ GitHub ]# File 'lib/capybara/rack_test/driver.rb', line 53
def submit(method, path, attributes) browser.submit(method, path, attributes) end
#title
[ GitHub ]# File 'lib/capybara/rack_test/driver.rb', line 93
def title browser.title end
#visit(path, **attributes)
[ GitHub ]# File 'lib/capybara/rack_test/driver.rb', line 45
def visit(path, **attributes) browser.visit(path, **attributes) end