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

Updated README to make driver registration and configuration more clear.

This commit is contained in:
Evan Prothro 2013-09-04 15:06:52 -05:00
parent 5e1d159adf
commit 1edd6e5da9

View file

@ -271,7 +271,7 @@ RackTest can be configured with a set of headers like this:
```ruby
Capybara.register_driver :rack_test do |app|
Capybara::RackTest::Driver.new(app, :headers => { 'User-Agent' => 'Capybara' })
Capybara::RackTest::Driver.new(app, :headers => { 'HTTP_USER_AGENT' => 'Capybara' })
end
```
@ -794,7 +794,7 @@ end
Capybara makes it convenient to switch between different drivers. It also exposes
an API to tweak those drivers with whatever settings you want, or to add your own
drivers. This is how to switch the selenium driver to use chrome:
drivers. This is how to override the selenium driver configuration to use chrome:
```ruby
Capybara.register_driver :selenium do |app|
@ -802,8 +802,7 @@ Capybara.register_driver :selenium do |app|
end
```
However, it's also possible to give this a different name, so tests can switch
between using different browsers effortlessly:
However, it's also possible to give this configuration a different name.
```ruby
Capybara.register_driver :selenium_chrome do |app|
@ -811,6 +810,11 @@ Capybara.register_driver :selenium_chrome do |app|
end
```
Then tests can switch between using different browsers effortlessly:
```ruby
Capybara.current_driver = :selenium_chrome
```
Whatever is returned from the block should conform to the API described by
Capybara::Driver::Base, it does not however have to inherit from this class.
Gems can use this API to add their own drivers to Capybara.