Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Update examples fill_in 'Email' and click_button #1317

Merged
merged 1 commit into from

3 participants

@stgeneral

Updates examples to click form button instead of a link and filling in fields labled as Email instead of Login.

Clean and full version of #1315 and #1316 pull requests.

@twalpole
Collaborator

What is the reason for this change? Capybara is not Devise specific, or even Rails specific - and neither are the examples in the README

@stgeneral

@twalpole the main reason is to make examples workable because click_link won't submit form.
And bit more logical user in example is created with email (not login) field.

Devise was just an example of widely used case.

@abotalov
Collaborator

LGTM

@twalpole twalpole merged commit 42aaeab into jnicklas:master

1 check failed

Details continuous-integration/travis-ci The Travis CI build failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 29, 2014
  1. @stgeneral
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 12 deletions.
  1. +12 −12 README.md
View
24 README.md
@@ -60,10 +60,10 @@ You can use the Capybara DSL in your steps, like so:
```ruby
When /I sign in/ do
within("#session") do
- fill_in 'Login', :with => 'user@example.com'
+ fill_in 'Email', :with => 'user@example.com'
fill_in 'Password', :with => 'password'
end
- click_link 'Sign in'
+ click_button 'Sign in'
end
```
@@ -105,10 +105,10 @@ describe "the signin process", :type => :feature do
it "signs me in" do
visit '/sessions/new'
within("#session") do
- fill_in 'Login', :with => 'user@example.com'
+ fill_in 'Email', :with => 'user@example.com'
fill_in 'Password', :with => 'password'
end
- click_link 'Sign in'
+ click_button 'Sign in'
expect(page).to have_content 'Success'
end
end
@@ -136,10 +136,10 @@ feature "Signing in" do
scenario "Signing in with correct credentials" do
visit '/sessions/new'
within("#session") do
- fill_in 'Login', :with => 'user@example.com'
+ fill_in 'Email', :with => 'user@example.com'
fill_in 'Password', :with => 'caplin'
end
- click_link 'Sign in'
+ click_button 'Sign in'
expect(page).to have_content 'Success'
end
@@ -148,10 +148,10 @@ feature "Signing in" do
scenario "Signing in as another user" do
visit '/sessions/new'
within("#session") do
- fill_in 'Login', :with => other_user.email
+ fill_in 'Email', :with => other_user.email
fill_in 'Password', :with => other_user.password
end
- click_link 'Sign in'
+ click_button 'Sign in'
expect(page).to have_content 'Invalid email or password'
end
end
@@ -667,10 +667,10 @@ module MyModule
def login!
within("//form[@id='session']") do
- fill_in 'Login', :with => 'user@example.com'
+ fill_in 'Email', :with => 'user@example.com'
fill_in 'Password', :with => 'password'
end
- click_link 'Sign in'
+ click_button 'Sign in'
end
end
```
@@ -717,10 +717,10 @@ require 'capybara'
session = Capybara::Session.new(:webkit, my_rack_app)
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'
end
-session.click_link 'Sign in'
+session.click_button 'Sign in'
```
## XPath, CSS and selectors
Something went wrong with that request. Please try again.