Class: Capybara::Driver::RackTest

Inherits:
Object
  • Object
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

Constructor Details

#initialize(app) ⇒ RackTest

Returns a new instance of RackTest.



124
125
126
# File 'lib/capybara/driver/rack_test_driver.rb', line 124

def initialize(app)
  @app = app
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



119
120
121
# File 'lib/capybara/driver/rack_test_driver.rb', line 119

def app
  @app
end

#bodyObject (readonly)

Returns the value of attribute body.



119
120
121
# File 'lib/capybara/driver/rack_test_driver.rb', line 119

def body
  @body
end

#htmlObject (readonly)

Returns the value of attribute html.



119
120
121
# File 'lib/capybara/driver/rack_test_driver.rb', line 119

def html
  @html
end

Instance Method Details

#find(selector) ⇒ Object



140
141
142
# File 'lib/capybara/driver/rack_test_driver.rb', line 140

def find(selector)
  html.xpath(selector).map { |node| Node.new(self, node) }
end

#submit(path, attributes) ⇒ Object



134
135
136
137
138
# File 'lib/capybara/driver/rack_test_driver.rb', line 134

def submit(path, attributes)
  post(path, attributes)
  follow_redirect! while response.redirect?
  cache_body  
end

#visit(path) ⇒ Object



128
129
130
131
132
# File 'lib/capybara/driver/rack_test_driver.rb', line 128

def visit(path)
  get(path)
  follow_redirect! while response.redirect?
  cache_body
end