Class: Capybara::Driver::RackTest
- Inherits:
-
Base
- Object
- Base
- Capybara::Driver::RackTest
show all
- Includes:
- Rack::Test::Methods
- Defined in:
- lib/capybara/driver/rack_test_driver.rb
Defined Under Namespace
Classes: Form, Node
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Base
#cleanup!, #evaluate_script, #has_shortcircuit_timeout?, #wait?, #wait_until, #within_frame
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
Returns the value of attribute app.
180
181
182
|
# File 'lib/capybara/driver/rack_test_driver.rb', line 180
def app
@app
end
|
Instance Method Details
#body ⇒ Object
Also known as:
source
217
218
219
|
# File 'lib/capybara/driver/rack_test_driver.rb', line 217
def body
@body ||= response.body
end
|
#current_url ⇒ Object
199
200
201
|
# File 'lib/capybara/driver/rack_test_driver.rb', line 199
def current_url
request.url rescue ""
end
|
#delete(*args, &block) ⇒ Object
229
|
# File 'lib/capybara/driver/rack_test_driver.rb', line 229
def delete(*args, &block); reset_cache; super; end
|
#find(selector) ⇒ Object
213
214
215
|
# File 'lib/capybara/driver/rack_test_driver.rb', line 213
def find(selector)
html.xpath(selector).map { |node| Node.new(self, node) }
end
|
#get(*args, &block) ⇒ Object
226
|
# File 'lib/capybara/driver/rack_test_driver.rb', line 226
def get(*args, &block); reset_cache; super; end
|
#html ⇒ Object
221
222
223
|
# File 'lib/capybara/driver/rack_test_driver.rb', line 221
def html
@html ||= Nokogiri::HTML(body)
end
|
#post(*args, &block) ⇒ Object
227
|
# File 'lib/capybara/driver/rack_test_driver.rb', line 227
def post(*args, &block); reset_cache; super; end
|
#process(method, path, attributes = {}) ⇒ Object
193
194
195
196
197
|
# File 'lib/capybara/driver/rack_test_driver.rb', line 193
def process(method, path, attributes = {})
return if path.gsub(/^#{current_path}/, '') =~ /^#/
send(method, path, attributes, env)
follow_redirects!
end
|
#put(*args, &block) ⇒ Object
228
|
# File 'lib/capybara/driver/rack_test_driver.rb', line 228
def put(*args, &block); reset_cache; super; end
|
203
204
205
|
# File 'lib/capybara/driver/rack_test_driver.rb', line 203
def
response.
end
|
#submit(method, path, attributes) ⇒ Object
207
208
209
210
211
|
# File 'lib/capybara/driver/rack_test_driver.rb', line 207
def submit(method, path, attributes)
path = current_path if not path or path.empty?
send(method, path, attributes, env)
follow_redirects!
end
|
#visit(path, attributes = {}) ⇒ Object
189
190
191
|
# File 'lib/capybara/driver/rack_test_driver.rb', line 189
def visit(path, attributes = {})
process(:get, path, attributes)
end
|