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

Merge pull request #1317 from stgeneral/update-readme-examples

Update examples fill_in 'Email' and click_button
This commit is contained in:
Thomas Walpole 2014-07-03 11:03:54 -07:00
commit 42aaeab109

View file

@ -60,10 +60,10 @@ You can use the Capybara DSL in your steps, like so:
```ruby ```ruby
When /I sign in/ do When /I sign in/ do
within("#session") do within("#session") do
fill_in 'Login', :with => 'user@example.com' fill_in 'Email', :with => 'user@example.com'
fill_in 'Password', :with => 'password' fill_in 'Password', :with => 'password'
end end
click_link 'Sign in' click_button 'Sign in'
end end
``` ```
@ -105,10 +105,10 @@ describe "the signin process", :type => :feature do
it "signs me in" do it "signs me in" do
visit '/sessions/new' visit '/sessions/new'
within("#session") do within("#session") do
fill_in 'Login', :with => 'user@example.com' fill_in 'Email', :with => 'user@example.com'
fill_in 'Password', :with => 'password' fill_in 'Password', :with => 'password'
end end
click_link 'Sign in' click_button 'Sign in'
expect(page).to have_content 'Success' expect(page).to have_content 'Success'
end end
end end
@ -136,10 +136,10 @@ feature "Signing in" do
scenario "Signing in with correct credentials" do scenario "Signing in with correct credentials" do
visit '/sessions/new' visit '/sessions/new'
within("#session") do within("#session") do
fill_in 'Login', :with => 'user@example.com' fill_in 'Email', :with => 'user@example.com'
fill_in 'Password', :with => 'caplin' fill_in 'Password', :with => 'caplin'
end end
click_link 'Sign in' click_button 'Sign in'
expect(page).to have_content 'Success' expect(page).to have_content 'Success'
end end
@ -148,10 +148,10 @@ feature "Signing in" do
scenario "Signing in as another user" do scenario "Signing in as another user" do
visit '/sessions/new' visit '/sessions/new'
within("#session") do within("#session") do
fill_in 'Login', :with => other_user.email fill_in 'Email', :with => other_user.email
fill_in 'Password', :with => other_user.password fill_in 'Password', :with => other_user.password
end end
click_link 'Sign in' click_button 'Sign in'
expect(page).to have_content 'Invalid email or password' expect(page).to have_content 'Invalid email or password'
end end
end end
@ -720,10 +720,10 @@ module MyModule
def login! def login!
within("//form[@id='session']") do within("//form[@id='session']") do
fill_in 'Login', :with => 'user@example.com' fill_in 'Email', :with => 'user@example.com'
fill_in 'Password', :with => 'password' fill_in 'Password', :with => 'password'
end end
click_link 'Sign in' click_button 'Sign in'
end end
end end
``` ```
@ -770,10 +770,10 @@ require 'capybara'
session = Capybara::Session.new(:webkit, my_rack_app) session = Capybara::Session.new(:webkit, my_rack_app)
session.within("//form[@id='session']") do session.within("//form[@id='session']") do
session.fill_in 'Login', :with => 'user@example.com' session.fill_in 'Email', :with => 'user@example.com'
session.fill_in 'Password', :with => 'password' session.fill_in 'Password', :with => 'password'
end end
session.click_link 'Sign in' session.click_button 'Sign in'
``` ```
## XPath, CSS and selectors ## XPath, CSS and selectors