Skip to content

Commit

Permalink
updated features and step definitions for new clearance
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Croak committed Sep 2, 2009
1 parent d0b8fb4 commit a0a8213
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 26 deletions.
23 changes: 12 additions & 11 deletions features/step_definitions/clearance_steps.rb
Expand Up @@ -51,27 +51,29 @@
sent = ActionMailer::Base.deliveries.first
assert_equal [user.email], sent.to
assert_match /confirm/i, sent.subject
assert !user.token.blank?
assert_match /#{user.token}/, sent.body
assert !user.confirmation_token.blank?
assert_match /#{user.confirmation_token}/, sent.body
end

When /^I follow the confirmation link sent to "(.*)"$/ do |email|
user = User.find_by_email(email)
visit new_user_confirmation_path(:user_id => user, :token => user.token)
visit new_user_confirmation_path(:user_id => user,
:token => user.confirmation_token)
end

Then /^a password reset message should be sent to "(.*)"$/ do |email|
user = User.find_by_email(email)
sent = ActionMailer::Base.deliveries.first
assert_equal [user.email], sent.to
assert_match /password/i, sent.subject
assert !user.token.blank?
assert_match /#{user.token}/, sent.body
assert !user.confirmation_token.blank?
assert_match /#{user.confirmation_token}/, sent.body
end

When /^I follow the password reset link sent to "(.*)"$/ do |email|
user = User.find_by_email(email)
visit edit_user_password_path(:user_id => user, :token => user.token)
visit edit_user_password_path(:user_id => user,
:token => user.confirmation_token)
end

When /^I try to change the password of "(.*)" without token$/ do |email|
Expand All @@ -85,11 +87,10 @@

# Actions

When /^I sign in( with "remember me")? as "(.*)\/(.*)"$/ do |remember, email, password|
When /^I sign in as "(.*)\/(.*)"$/ do |email, password|
When %{I go to the sign in page}
And %{I fill in "Email" with "#{email}"}
And %{I fill in "Password" with "#{password}"}
And %{I check "Remember me"} if remember
And %{I press "Sign In"}
end

Expand All @@ -99,13 +100,13 @@

When /^I request password reset link to be sent to "(.*)"$/ do |email|
When %{I go to the password reset request page}
And %{I fill in "Email" with "#{email}"}
And %{I fill in "Email address" with "#{email}"}
And %{I press "Reset password"}
end

When /^I update my password with "(.*)\/(.*)"$/ do |password, confirmation|
And %{I fill in "Password" with "#{password}"}
And %{I fill in "Password confirmation" with "#{confirmation}"}
And %{I fill in "Choose password" with "#{password}"}
And %{I fill in "Confirm password" with "#{confirmation}"}
And %{I press "Save this password"}
end

Expand Down
7 changes: 0 additions & 7 deletions features/users/sign_in.feature
Expand Up @@ -30,13 +30,6 @@ Feature: Sign in
And I sign in as "email@person.com/password"
Then I should see "Signed in"
And I should be signed in

Scenario: User signs in and checks "remember me"
Given I am signed up and confirmed as "email@person.com/password"
When I go to the sign in page
And I sign in with "remember me" as "email@person.com/password"
Then I should see "Signed in"
And I should be signed in
When I return next time
Then I should be signed in

8 changes: 0 additions & 8 deletions features/users/sign_out.feature
Expand Up @@ -10,14 +10,6 @@ Feature: Sign out
And I sign out
Then I should see "Signed out"
And I should be signed out

Scenario: User who was remembered signs out
Given I am signed up and confirmed as "email@person.com/password"
When I sign in with "remember me" as "email@person.com/password"
Then I should be signed in
And I sign out
Then I should see "Signed out"
And I should be signed out
When I return next time
Then I should be signed out

0 comments on commit a0a8213

Please sign in to comment.