Included Modules

Capybara::Driver::RackTest

Attributes

app[R]

Public Class Methods

new(app) click to toggle source
# File lib/capybara/driver/rack_test_driver.rb, line 192
def initialize(app)
  raise ArgumentError, "rack-test requires a rack application, but none was given" unless app
  @app = app
end

Public Instance Methods

body() click to toggle source
# File lib/capybara/driver/rack_test_driver.rb, line 229
def body
  @body ||= response.body
end
Also aliased as: source
cleanup!() click to toggle source
# File lib/capybara/driver/rack_test_driver.rb, line 238
def cleanup!
  clear_cookies
end
current_url() click to toggle source
# File lib/capybara/driver/rack_test_driver.rb, line 207
def current_url
  request.url rescue ""
end
delete(*args, &block) click to toggle source
# File lib/capybara/driver/rack_test_driver.rb, line 245
def delete(*args, &block); reset_cache; super; end
find(selector) click to toggle source
# File lib/capybara/driver/rack_test_driver.rb, line 225
def find(selector)
  html.xpath(selector).map { |node| Node.new(self, node) }
end
follow_redirects!() click to toggle source
# File lib/capybara/driver/rack_test_driver.rb, line 247
def follow_redirects!
  5.times do
    follow_redirect! if response.redirect?
  end
  raise Capybara::InfiniteRedirectError, "redirected more than 5 times, check for infinite redirects." if response.redirect?
end
get(*args, &block) click to toggle source
# File lib/capybara/driver/rack_test_driver.rb, line 242
def get(*args, &block); reset_cache; super; end
html() click to toggle source
# File lib/capybara/driver/rack_test_driver.rb, line 233
def html
  @html ||= Nokogiri::HTML(body)
end
post(*args, &block) click to toggle source
# File lib/capybara/driver/rack_test_driver.rb, line 243
def post(*args, &block); reset_cache; super; end
process(method, path, attributes = {}) click to toggle source
# File lib/capybara/driver/rack_test_driver.rb, line 201
def process(method, path, attributes = {})
  return if path.gsub(/^#{request_path}/, '') =~ /^#/
  send(method, path, attributes, env)
  follow_redirects!
end
put(*args, &block) click to toggle source
# File lib/capybara/driver/rack_test_driver.rb, line 244
def put(*args, &block); reset_cache; super; end
response_headers() click to toggle source
# File lib/capybara/driver/rack_test_driver.rb, line 211
def response_headers
  response.headers
end
source() click to toggle source
Alias for: body
status_code() click to toggle source
# File lib/capybara/driver/rack_test_driver.rb, line 215
def status_code
  response.status
end
submit(method, path, attributes) click to toggle source
# File lib/capybara/driver/rack_test_driver.rb, line 219
def submit(method, path, attributes)
  path = request_path if not path or path.empty?
  send(method, path, attributes, env)
  follow_redirects!
end
visit(path, attributes = {}) click to toggle source
# File lib/capybara/driver/rack_test_driver.rb, line 197
def visit(path, attributes = {})
  process(:get, path, attributes)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.