|
27 | 27 | end |
28 | 28 | end |
29 | 29 |
|
30 | | - describe "Fails" do |
31 | | - it "should fail registration because email already exists" do |
| 30 | + describe "Fails registration" do |
| 31 | + before(:each) do |
| 32 | + visit new_user_registration_path |
| 33 | + end |
| 34 | + |
| 35 | + it "email already exists" do |
32 | 36 | fill_in 'Email', with: existing_user.email |
33 | 37 | fill_in 'Password', with: 'password' |
34 | 38 | fill_in 'Password confirmation', with: 'password' |
|
39 | 43 | expect(page).to have_content("Email has already been taken") |
40 | 44 | end |
41 | 45 |
|
42 | | - it "should fail registration because passwords do not match" do |
| 46 | + it "passwords do not match" do |
43 | 47 | fill_in 'Email', with: '[email protected]' |
44 | | - fill_in 'Password', with: 'password' |
45 | | - fill_in 'Password confirmation', with: 'passwordz' |
| 48 | + fill_in 'Password', with: 'password' |
| 49 | + fill_in 'Password confirmation', with: 'passwordz' |
46 | 50 |
|
47 | 51 | click_on('Join us') |
48 | 52 |
|
|
51 | 55 | end |
52 | 56 |
|
53 | 57 |
|
54 | | - it "should fail registration because email address is incorrect" do |
| 58 | + it "email address is incorrect" do |
55 | 59 | fill_in 'Email', with: 'mars-example.com' |
56 | | - fill_in 'Password', with: 'password' |
57 | | - fill_in 'Password confirmation', with: 'password' |
| 60 | + fill_in 'Password', with: 'password' |
| 61 | + fill_in 'Password confirmation', with: 'password' |
| 62 | + |
| 63 | + click_on('Join us') |
| 64 | + |
| 65 | + expect(page).to have_content("2 errors prohibited this user from being saved") |
| 66 | + expect(page).to have_content("must be a valid email address") |
| 67 | + end |
| 68 | + |
| 69 | + it "email address contains uncommon number of characters" do |
| 70 | + fill_in 'Email', with: '[email protected]' |
| 71 | + fill_in 'Password', with: 'password' |
| 72 | + fill_in 'Password confirmation', with: 'password' |
| 73 | + |
| 74 | + click_on('Join us') |
| 75 | + |
| 76 | + expect(page).to have_content("1 error prohibited this user from being saved") |
| 77 | + expect(page).to have_content("must be a valid email address") |
| 78 | + end |
| 79 | + |
| 80 | + it "email address handle ends with a dot" do |
| 81 | + fill_in 'Email', with: '[email protected]' |
| 82 | + fill_in 'Password', with: 'password' |
| 83 | + fill_in 'Password confirmation', with: 'password' |
58 | 84 |
|
59 | 85 | click_on('Join us') |
60 | 86 |
|
61 | 87 | expect(page).to have_content("1 error prohibited this user from being saved") |
62 | | - expect(page).to have_content("Email is invalid") |
| 88 | + expect(page).to have_content("must be a valid email address") |
63 | 89 | end |
64 | 90 | end |
65 | 91 | end |
|
0 commit comments