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

Merge branch 'rspec_doc_updates' of git://github.com/alindeman/capybara into alindeman-rspec_doc_updates

Conflicts:
	README.md
This commit is contained in:
Jonas Nicklas 2012-11-14 16:52:59 +01:00
commit 7d4dfada61

View file

@ -88,16 +88,15 @@ Load RSpec 2.x support by adding the following line (typically to your
require 'capybara/rspec' require 'capybara/rspec'
``` ```
If you are using Rails, put your Capybara specs in `spec/requests` or If you are using Rails, put your Capybara specs in `spec/features`.
`spec/integration`.
If you are not using Rails, tag all the example groups in which you want to use If you are not using Rails, tag all the example groups in which you want to use
Capybara with `:type => :request`. Capybara with `:type => :feature`.
You can now write your specs like so: You can now write your specs like so:
```ruby ```ruby
describe "the signup process", :type => :request do describe "the signup process", :type => :feature do
before :each do before :each do
User.make(:email => 'user@example.com', :password => 'caplin') User.make(:email => 'user@example.com', :password => 'caplin')
end end
@ -140,7 +139,7 @@ feature "Signing up" do
end end
given(:other_user) { User.make(:email => 'other@example.com', :password => 'rous') } given(:other_user) { User.make(:email => 'other@example.com', :password => 'rous') }
scenario "Signing in as another user" do scenario "Signing in as another user" do
within("#session") do within("#session") do
fill_in 'Login', :with => other_user.email fill_in 'Login', :with => other_user.email
@ -151,8 +150,9 @@ feature "Signing up" do
end end
``` ```
`feature` is in fact just an alias for `describe ..., :type => :request`, `feature` is in fact just an alias for `describe ..., :type => :feature`,
`background` is an alias for `before`, `scenario` for `it`, and `given`/`given!` aliases for `let`/`let!`, respectively. `background` is an alias for `before`, `scenario` for `it`, and
`given`/`given!` aliases for `let`/`let!`, respectively.
## Using Capybara with Test::Unit ## Using Capybara with Test::Unit