1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

README.md: tweak language re: RackTest driver's lack of remote capabilities

This commit is contained in:
Jeff Lee 2012-07-17 13:03:30 -04:00
parent 266b6947c4
commit b11bbe9135

View file

@ -32,6 +32,9 @@ If you are not using Rails, set Capybara.app to your rack app:
Capybara.app = MyRackApp Capybara.app = MyRackApp
``` ```
If you need to test JavaScript, or if your app interacts with (or is located at)
a remote URL, you'll need to [use a different driver](#drivers).
## Using Capybara with Cucumber ## Using Capybara with Cucumber
The `cucumber-rails` gem comes with Capybara support built-in. If you The `cucumber-rails` gem comes with Capybara support built-in. If you
@ -217,10 +220,11 @@ Capybara uses the same DSL to drive a variety of browser and headless drivers.
### Selecting the Driver ### Selecting the Driver
By default, Capybara uses the `:rack_test` driver, which is fast but does not By default, Capybara uses the `:rack_test` driver, which is fast but limited: it
support JavaScript. You can set up a different default driver for your does not support JavaScript, nor is it able to access HTTP resources outside of
features. For example if you'd prefer to run everything in Selenium, you could your Rack application, such as remote APIs and OAuth services. To get around
do: these limitations, you can set up a different default driver for your features.
For example if you'd prefer to run everything in Selenium, you could do:
```ruby ```ruby
Capybara.default_driver = :selenium Capybara.default_driver = :selenium
@ -248,15 +252,16 @@ switch in the middle of a test.
### RackTest ### RackTest
RackTest is Capybara's default driver. It is written in pure Ruby and does not RackTest is Capybara's default driver. It is written in pure Ruby and does not
have any support for executing JavaScript. Since the RackTest driver works have any support for executing JavaScript. Since the RackTest driver interacts
directly against the Rack interface, it does not need any server to be started, directly with Rack interfaces, it does not require a server to be started.
it can work directly against any Rack app. This means that if your However, this means that if your application is not a Rack application (Rails,
application is not a Rack application (Rails, Sinatra and most other Ruby Sinatra and most other Ruby frameworks are Rack applications) then you cannot
frameworks are Rack applications) then you cannot use this driver. You cannot use this driver. Furthermore, you cannot use the RackTest driver to test a
use the RackTest driver to test a remote application. remote application, or to access remote URLs (e.g., HTTP redirects, external
APIs, or OAuth services) that your application might interact with.
[capybara-mechanize](https://github.com/jeroenvandijk/capybara-mechanize) [capybara-mechanize](https://github.com/jeroenvandijk/capybara-mechanize)
intends to provide a similar driver which works against remote servers, it is a provides a similar driver that can access remote servers.
separate project.
RackTest can be configured with a set of headers like this: RackTest can be configured with a set of headers like this: