Class: Capybara::Driver::RackTest
- Includes:
- Rack::Test::Methods
- Defined in:
- lib/capybara/driver/rack_test_driver.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#body ⇒ Object
(also: #source)
readonly
Returns the value of attribute body.
-
#html ⇒ Object
readonly
Returns the value of attribute html.
Instance Method Summary collapse
- #current_url ⇒ Object
- #find(selector) ⇒ Object
-
#initialize(app) ⇒ RackTest
constructor
A new instance of RackTest.
- #response_headers ⇒ Object
- #submit(method, path, attributes) ⇒ Object
- #visit(path, attributes = {}) ⇒ Object
Methods inherited from Base
#cleanup!, #evaluate_script, #wait?
Constructor Details
#initialize(app) ⇒ RackTest
Returns a new instance of RackTest.
185 186 187 |
# File 'lib/capybara/driver/rack_test_driver.rb', line 185 def initialize(app) @app = app end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
179 180 181 |
# File 'lib/capybara/driver/rack_test_driver.rb', line 179 def app @app end |
#body ⇒ Object (readonly) Also known as: source
Returns the value of attribute body.
179 180 181 |
# File 'lib/capybara/driver/rack_test_driver.rb', line 179 def body @body end |
#html ⇒ Object (readonly)
Returns the value of attribute html.
179 180 181 |
# File 'lib/capybara/driver/rack_test_driver.rb', line 179 def html @html end |
Instance Method Details
#current_url ⇒ Object
196 197 198 |
# File 'lib/capybara/driver/rack_test_driver.rb', line 196 def current_url request.url rescue "" end |
#find(selector) ⇒ Object
211 212 213 |
# File 'lib/capybara/driver/rack_test_driver.rb', line 211 def find(selector) html.xpath(selector).map { |node| Node.new(self, node) } end |
#response_headers ⇒ Object
200 201 202 |
# File 'lib/capybara/driver/rack_test_driver.rb', line 200 def response_headers response.headers end |
#submit(method, path, attributes) ⇒ Object
204 205 206 207 208 209 |
# File 'lib/capybara/driver/rack_test_driver.rb', line 204 def submit(method, path, attributes) path = current_path if not path or path.empty? send(method, path, attributes, env) follow_redirects! cache_body end |
#visit(path, attributes = {}) ⇒ Object
189 190 191 192 193 194 |
# File 'lib/capybara/driver/rack_test_driver.rb', line 189 def visit(path, attributes = {}) return if path.gsub(/^#{current_path}/, '') =~ /^#/ get(path, attributes, env) follow_redirects! cache_body end |