Commit a0a8213c4fd73e6cda401e5a12683c93802995ae
1 parent
d0b8fb41
Exists in
master
and in
1 other branch
updated features and step definitions for new clearance
Showing
3 changed files
with
12 additions
and
26 deletions
Show diff stats
features/step_definitions/clearance_steps.rb
@@ -51,13 +51,14 @@ Then /^a confirmation message should be sent to "(.*)"$/ do |email| | @@ -51,13 +51,14 @@ Then /^a confirmation message should be sent to "(.*)"$/ do |email| | ||
51 | sent = ActionMailer::Base.deliveries.first | 51 | sent = ActionMailer::Base.deliveries.first |
52 | assert_equal [user.email], sent.to | 52 | assert_equal [user.email], sent.to |
53 | assert_match /confirm/i, sent.subject | 53 | assert_match /confirm/i, sent.subject |
54 | - assert !user.token.blank? | ||
55 | - assert_match /#{user.token}/, sent.body | 54 | + assert !user.confirmation_token.blank? |
55 | + assert_match /#{user.confirmation_token}/, sent.body | ||
56 | end | 56 | end |
57 | 57 | ||
58 | When /^I follow the confirmation link sent to "(.*)"$/ do |email| | 58 | When /^I follow the confirmation link sent to "(.*)"$/ do |email| |
59 | user = User.find_by_email(email) | 59 | user = User.find_by_email(email) |
60 | - visit new_user_confirmation_path(:user_id => user, :token => user.token) | 60 | + visit new_user_confirmation_path(:user_id => user, |
61 | + :token => user.confirmation_token) | ||
61 | end | 62 | end |
62 | 63 | ||
63 | Then /^a password reset message should be sent to "(.*)"$/ do |email| | 64 | Then /^a password reset message should be sent to "(.*)"$/ do |email| |
@@ -65,13 +66,14 @@ Then /^a password reset message should be sent to "(.*)"$/ do |email| | @@ -65,13 +66,14 @@ Then /^a password reset message should be sent to "(.*)"$/ do |email| | ||
65 | sent = ActionMailer::Base.deliveries.first | 66 | sent = ActionMailer::Base.deliveries.first |
66 | assert_equal [user.email], sent.to | 67 | assert_equal [user.email], sent.to |
67 | assert_match /password/i, sent.subject | 68 | assert_match /password/i, sent.subject |
68 | - assert !user.token.blank? | ||
69 | - assert_match /#{user.token}/, sent.body | 69 | + assert !user.confirmation_token.blank? |
70 | + assert_match /#{user.confirmation_token}/, sent.body | ||
70 | end | 71 | end |
71 | 72 | ||
72 | When /^I follow the password reset link sent to "(.*)"$/ do |email| | 73 | When /^I follow the password reset link sent to "(.*)"$/ do |email| |
73 | user = User.find_by_email(email) | 74 | user = User.find_by_email(email) |
74 | - visit edit_user_password_path(:user_id => user, :token => user.token) | 75 | + visit edit_user_password_path(:user_id => user, |
76 | + :token => user.confirmation_token) | ||
75 | end | 77 | end |
76 | 78 | ||
77 | When /^I try to change the password of "(.*)" without token$/ do |email| | 79 | When /^I try to change the password of "(.*)" without token$/ do |email| |
@@ -85,11 +87,10 @@ end | @@ -85,11 +87,10 @@ end | ||
85 | 87 | ||
86 | # Actions | 88 | # Actions |
87 | 89 | ||
88 | -When /^I sign in( with "remember me")? as "(.*)\/(.*)"$/ do |remember, email, password| | 90 | +When /^I sign in as "(.*)\/(.*)"$/ do |email, password| |
89 | When %{I go to the sign in page} | 91 | When %{I go to the sign in page} |
90 | And %{I fill in "Email" with "#{email}"} | 92 | And %{I fill in "Email" with "#{email}"} |
91 | And %{I fill in "Password" with "#{password}"} | 93 | And %{I fill in "Password" with "#{password}"} |
92 | - And %{I check "Remember me"} if remember | ||
93 | And %{I press "Sign In"} | 94 | And %{I press "Sign In"} |
94 | end | 95 | end |
95 | 96 | ||
@@ -99,13 +100,13 @@ end | @@ -99,13 +100,13 @@ end | ||
99 | 100 | ||
100 | When /^I request password reset link to be sent to "(.*)"$/ do |email| | 101 | When /^I request password reset link to be sent to "(.*)"$/ do |email| |
101 | When %{I go to the password reset request page} | 102 | When %{I go to the password reset request page} |
102 | - And %{I fill in "Email" with "#{email}"} | 103 | + And %{I fill in "Email address" with "#{email}"} |
103 | And %{I press "Reset password"} | 104 | And %{I press "Reset password"} |
104 | end | 105 | end |
105 | 106 | ||
106 | When /^I update my password with "(.*)\/(.*)"$/ do |password, confirmation| | 107 | When /^I update my password with "(.*)\/(.*)"$/ do |password, confirmation| |
107 | - And %{I fill in "Password" with "#{password}"} | ||
108 | - And %{I fill in "Password confirmation" with "#{confirmation}"} | 108 | + And %{I fill in "Choose password" with "#{password}"} |
109 | + And %{I fill in "Confirm password" with "#{confirmation}"} | ||
109 | And %{I press "Save this password"} | 110 | And %{I press "Save this password"} |
110 | end | 111 | end |
111 | 112 |
features/users/sign_in.feature
@@ -30,13 +30,6 @@ Feature: Sign in | @@ -30,13 +30,6 @@ Feature: Sign in | ||
30 | And I sign in as "email@person.com/password" | 30 | And I sign in as "email@person.com/password" |
31 | Then I should see "Signed in" | 31 | Then I should see "Signed in" |
32 | And I should be signed in | 32 | And I should be signed in |
33 | - | ||
34 | - Scenario: User signs in and checks "remember me" | ||
35 | - Given I am signed up and confirmed as "email@person.com/password" | ||
36 | - When I go to the sign in page | ||
37 | - And I sign in with "remember me" as "email@person.com/password" | ||
38 | - Then I should see "Signed in" | ||
39 | - And I should be signed in | ||
40 | When I return next time | 33 | When I return next time |
41 | Then I should be signed in | 34 | Then I should be signed in |
42 | 35 |
features/users/sign_out.feature
@@ -10,14 +10,6 @@ Feature: Sign out | @@ -10,14 +10,6 @@ Feature: Sign out | ||
10 | And I sign out | 10 | And I sign out |
11 | Then I should see "Signed out" | 11 | Then I should see "Signed out" |
12 | And I should be signed out | 12 | And I should be signed out |
13 | - | ||
14 | - Scenario: User who was remembered signs out | ||
15 | - Given I am signed up and confirmed as "email@person.com/password" | ||
16 | - When I sign in with "remember me" as "email@person.com/password" | ||
17 | - Then I should be signed in | ||
18 | - And I sign out | ||
19 | - Then I should see "Signed out" | ||
20 | - And I should be signed out | ||
21 | When I return next time | 13 | When I return next time |
22 | Then I should be signed out | 14 | Then I should be signed out |
23 | 15 |