forked from turingschool-projects/little_shop_v2
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User story8 and User story11 #110
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
faa24bb
Added test that fields cannot be blank for user registration test.
zachlp2016 394cba2
Added test to verify that form won't save if fields are blank.
zachlp2016 239a340
Added test to verify output of error message if credentials are bad.
zachlp2016 94eee20
Added test for login spec to show error message and verified it's wor…
zachlp2016 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,15 +51,27 @@ | |
expect(current_path).to eq(root_path) | ||
expect(page).to have_content('You are now logged in.') | ||
end | ||
|
||
it 'shows error message if credentials are bad' do | ||
visit login_path | ||
|
||
fill_in 'Email', with: "[email protected]" | ||
fill_in 'Password', with: "password" | ||
|
||
click_button('Login') | ||
|
||
save_and_open_page | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just make sure to remove this on the next PR @zachlp2016 |
||
|
||
expect(current_path).to eq(login_path) | ||
expect(page).to have_content('Those are the wrong credentials.') | ||
end | ||
end | ||
end | ||
# | ||
|
||
# | ||
# As a visitor | ||
# When I visit the login path | ||
# I see a field to enter my email address and password | ||
# When I submit valid information | ||
# If I am a regular user, I am redirected to my profile page | ||
# If I am a merchant user, I am redirected to my merchant dashboard page | ||
# If I am an admin user, I am redirected to the home page of the site | ||
# And I see a flash message that I am logged in | ||
# When I visit the login page ("/login") | ||
# And I submit valid information | ||
# Then I am redirected to the login page | ||
# And I see a flash message that tells me that my credentials were incorrect | ||
# I am NOT told whether it was my email or password that was incorrect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,5 +102,35 @@ | |
expect(new_user.name).to eq('User_1') | ||
end | ||
end | ||
|
||
it 'Will not let me register if fields are missing' do | ||
visit root_path | ||
|
||
within '.navbar' do | ||
click_link('Register') | ||
end | ||
|
||
fill_in 'Name', with: '' | ||
fill_in 'Address', with: '1111 South One St.' | ||
fill_in 'City', with: 'Denver' | ||
fill_in 'State', with: '' | ||
fill_in 'Zip', with: '80000' | ||
fill_in 'Email', with: '[email protected]' | ||
fill_in 'Password', with: '' | ||
fill_in 'Confirm password', with: '' | ||
|
||
click_button 'Create User' | ||
|
||
expect(current_path).to eq(register_path) | ||
expect(page).to have_content("Name can't be blank") | ||
expect(page).to have_content("State can't be blank") | ||
expect(page).to have_content("Password can't be blank") | ||
end | ||
end | ||
end | ||
# | ||
# As a visitor | ||
# When I visit the user registration page | ||
# And I do not fill in this form completely, | ||
# I am returned to the registration page | ||
# And I see a flash message indicating that I am missing required fields |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
High Level: Rails pipes missing/incorrect fields as errors into the User , which can then be printed on the View.