clearance 0.9.1 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of clearance might be problematic. Click here for more details.
- data/CHANGELOG.md +20 -1
- data/README.md +20 -20
- data/VERSION +1 -1
- data/app/controllers/clearance/passwords_controller.rb +0 -1
- data/app/controllers/clearance/sessions_controller.rb +3 -16
- data/app/controllers/clearance/users_controller.rb +2 -2
- data/app/models/clearance_mailer.rb +0 -11
- data/app/views/passwords/edit.html.erb +1 -1
- data/app/views/passwords/new.html.erb +1 -1
- data/app/views/sessions/new.html.erb +1 -1
- data/app/views/users/new.html.erb +1 -1
- data/clearance.gemspec +2 -10
- data/config/routes.rb +0 -4
- data/lib/clearance/shoulda_macros.rb +1 -9
- data/lib/clearance/user.rb +2 -18
- data/lib/rails/generators/clearance_features_templates/features/password_reset.feature +6 -0
- data/lib/rails/generators/clearance_features_templates/features/sign_in.feature +2 -10
- data/lib/rails/generators/clearance_features_templates/features/sign_out.feature +1 -1
- data/lib/rails/generators/clearance_features_templates/features/sign_up.feature +1 -26
- data/lib/rails/generators/clearance_features_templates/features/step_definitions/clearance_steps.rb +7 -28
- data/lib/rails/generators/clearance_templates/factories.rb +1 -1
- data/lib/rails/generators/clearance_templates/migrations/create_users.rb +0 -1
- data/lib/rails/generators/clearance_templates/migrations/update_users.rb +1 -2
- data/test/controllers/sessions_controller_test.rb +7 -40
- data/test/controllers/users_controller_test.rb +2 -4
- data/test/models/clearance_mailer_test.rb +1 -27
- data/test/models/user_test.rb +10 -46
- data/test/rails_root/test/factories/clearance.rb +1 -1
- metadata +23 -23
- data/app/controllers/clearance/confirmations_controller.rb +0 -74
- data/app/views/clearance_mailer/confirmation.html.erb +0 -5
- data/spec/rails_root/db/schema.rb +0 -29
- data/spec/rails_root/features/password_reset.feature +0 -33
- data/spec/rails_root/features/sign_in.feature +0 -35
- data/spec/rails_root/features/sign_out.feature +0 -15
- data/spec/rails_root/features/sign_up.feature +0 -45
- data/spec/rails_root/features/step_definitions/clearance_steps.rb +0 -138
- data/test/controllers/confirmations_controller_test.rb +0 -107
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,23 @@
|
|
1
|
-
0.
|
1
|
+
0.10.0
|
2
|
+
------------------
|
3
|
+
|
4
|
+
* Lots of README cleanup
|
5
|
+
* Better email validation regex
|
6
|
+
* Removed email confirmation step, was mostly a hassle and can always be added back in
|
7
|
+
at the application level (instead of engine level) if necessary
|
8
|
+
* Removed disable_with on forms since it does not allow IE users to submit forms. See more:
|
9
|
+
|
10
|
+
https://github.com/rails/jquery-ujs/issues#issue/30
|
11
|
+
http://bugs.jquery.com/ticket/7061
|
12
|
+
|
13
|
+
0.9.x
|
14
|
+
------------------
|
15
|
+
|
16
|
+
Forgot to update the changelog in a while, this is going to be brief:
|
17
|
+
|
18
|
+
* This release supports Rails 3, capybara, and shoulda 2.10+.
|
19
|
+
|
20
|
+
0.8.9
|
2
21
|
------------------
|
3
22
|
|
4
23
|
* Removed unnecessary db index. (Rich Thornett, doctorzaius)
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@ Rails authentication with email & password.
|
|
8
8
|
Help
|
9
9
|
----
|
10
10
|
|
11
|
-
* [documentation](http://rdoc.info/
|
11
|
+
* [documentation](http://rdoc.info/gems/clearance)
|
12
12
|
* [#thoughtbot](irc://irc.freenode.net/thoughtbot) IRC channel on freenode
|
13
13
|
* [mailing list](http://groups.google.com/group/thoughtbot-clearance)
|
14
14
|
|
@@ -20,27 +20,24 @@ Fork away and create a [Github Issue](http://github.com/thoughtbot/clearance/iss
|
|
20
20
|
Installation
|
21
21
|
------------
|
22
22
|
|
23
|
-
Clearance is a Rails engine
|
23
|
+
Clearance is a Rails engine for Rails 3.
|
24
24
|
|
25
|
-
|
25
|
+
Use the [0.8.x](https://github.com/thoughtbot/clearance/tree/v0.8.8)
|
26
|
+
series of Clearance if you have a Rails 2 app.
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
28
|
+
Include the gem in your Gemfile:
|
29
|
+
|
30
|
+
gem "clearance"
|
30
31
|
|
31
32
|
Make sure the development database exists, then run the generator:
|
32
33
|
|
33
|
-
|
34
|
+
rails generate clearance
|
34
35
|
|
35
36
|
This:
|
36
37
|
|
37
38
|
* inserts Clearance::User into your User model
|
38
39
|
* inserts Clearance::Authentication into your ApplicationController
|
39
|
-
*
|
40
|
-
|
41
|
-
There is a release candidate which features Rails 3 support. To install this version:
|
42
|
-
|
43
|
-
gem install clearance --prerelease
|
40
|
+
* creates a migration that either creates a users table or adds only missing columns
|
44
41
|
|
45
42
|
Usage
|
46
43
|
-----
|
@@ -111,6 +108,16 @@ Clearance has another generator to generate Formastic views:
|
|
111
108
|
|
112
109
|
Its implementation is designed so other view styles (Haml?) can be generated.
|
113
110
|
|
111
|
+
Extensions
|
112
|
+
----------
|
113
|
+
|
114
|
+
Clearance is intended to be small, simple, well-tested, and easy to extend.
|
115
|
+
Check out some of the ways people have extended Clearance:
|
116
|
+
|
117
|
+
* [Clearance HTTP Auth](https://github.com/karmi/clearance_http_auth)
|
118
|
+
* [Clearance Twitter](https://github.com/thoughtbot/clearance-twitter)
|
119
|
+
* [Clearance Admin](https://github.com/xenda/clearance-admin)
|
120
|
+
|
114
121
|
Authors
|
115
122
|
-------
|
116
123
|
|
@@ -118,11 +125,4 @@ Clearance was extracted out of [Hoptoad](http://hoptoadapp.com). We merged the
|
|
118
125
|
authentication code from two of thoughtbot's client Rails apps and have since
|
119
126
|
used it each time we needed authentication.
|
120
127
|
|
121
|
-
|
122
|
-
|
123
|
-
Dan Croak, Mike Burns, Jason Morrison, Joe Ferris, Eugene Bolshakov,
|
124
|
-
Nick Quaranto, Josh Nichols, Mike Breen, Marcel Görner, Bence Nagy, Ben Mabey,
|
125
|
-
Eloy Duran, Tim Pope, Mihai Anca, Mark Cornick, Shay Arnett, Joshua Clayton,
|
126
|
-
Mustafa Ekim, Jon Yurek, Anuj Dutta, Chad Pytel, Ben Orenstein, Bobby Wilson,
|
127
|
-
Matthew Ford, Ryan McGeary, Claudio Poli, Joseph Holsten, Peter Haza,
|
128
|
-
Ron Newman, and Rich Thornett.
|
128
|
+
Thank you to all [the contributors](https://github.com/thoughtbot/clearance/contributors)!
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.10.0
|
@@ -33,7 +33,6 @@ class Clearance::PasswordsController < ApplicationController
|
|
33
33
|
|
34
34
|
if @user.update_password(params[:user][:password],
|
35
35
|
params[:user][:password_confirmation])
|
36
|
-
@user.confirm_email!
|
37
36
|
sign_in(@user)
|
38
37
|
flash_success_after_update
|
39
38
|
redirect_to(url_after_update)
|
@@ -15,15 +15,9 @@ class Clearance::SessionsController < ApplicationController
|
|
15
15
|
flash_failure_after_create
|
16
16
|
render :template => 'sessions/new', :status => :unauthorized
|
17
17
|
else
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
redirect_back_or(url_after_create)
|
22
|
-
else
|
23
|
-
::ClearanceMailer.confirmation(@user).deliver
|
24
|
-
flash_notice_after_create
|
25
|
-
redirect_to(sign_in_url)
|
26
|
-
end
|
18
|
+
sign_in(@user)
|
19
|
+
flash_success_after_create
|
20
|
+
redirect_back_or(url_after_create)
|
27
21
|
end
|
28
22
|
end
|
29
23
|
|
@@ -45,13 +39,6 @@ class Clearance::SessionsController < ApplicationController
|
|
45
39
|
flash[:success] = translate(:signed_in, :default => "Signed in.")
|
46
40
|
end
|
47
41
|
|
48
|
-
def flash_notice_after_create
|
49
|
-
flash[:notice] = translate(:unconfirmed_email,
|
50
|
-
:scope => [:clearance, :controllers, :sessions],
|
51
|
-
:default => "User has not confirmed email. " <<
|
52
|
-
"Confirmation email will be resent.")
|
53
|
-
end
|
54
|
-
|
55
42
|
def url_after_create
|
56
43
|
'/'
|
57
44
|
end
|
@@ -13,6 +13,7 @@ class Clearance::UsersController < ApplicationController
|
|
13
13
|
@user = ::User.new params[:user]
|
14
14
|
if @user.save
|
15
15
|
flash_notice_after_create
|
16
|
+
sign_in(@user)
|
16
17
|
redirect_to(url_after_create)
|
17
18
|
else
|
18
19
|
render :template => 'users/new'
|
@@ -24,8 +25,7 @@ class Clearance::UsersController < ApplicationController
|
|
24
25
|
def flash_notice_after_create
|
25
26
|
flash[:notice] = translate(:deliver_confirmation,
|
26
27
|
:scope => [:clearance, :controllers, :users],
|
27
|
-
:default => "You
|
28
|
-
"It contains instructions for confirming your account.")
|
28
|
+
:default => "You are now signed up.")
|
29
29
|
end
|
30
30
|
|
31
31
|
def url_after_create
|
@@ -1,5 +1,4 @@
|
|
1
1
|
class ClearanceMailer < ActionMailer::Base
|
2
|
-
|
3
2
|
def change_password(user)
|
4
3
|
@user = user
|
5
4
|
from Clearance.configuration.mailer_sender
|
@@ -8,14 +7,4 @@ class ClearanceMailer < ActionMailer::Base
|
|
8
7
|
:scope => [:clearance, :models, :clearance_mailer],
|
9
8
|
:default => "Change your password")
|
10
9
|
end
|
11
|
-
|
12
|
-
def confirmation(user)
|
13
|
-
@user = user
|
14
|
-
from Clearance.configuration.mailer_sender
|
15
|
-
recipients @user.email
|
16
|
-
subject I18n.t(:confirmation,
|
17
|
-
:scope => [:clearance, :models, :clearance_mailer],
|
18
|
-
:default => "Account confirmation")
|
19
|
-
end
|
20
|
-
|
21
10
|
end
|
data/clearance.gemspec
CHANGED
@@ -18,13 +18,11 @@ Gem::Specification.new do |s|
|
|
18
18
|
"README.md",
|
19
19
|
"Rakefile",
|
20
20
|
"VERSION",
|
21
|
-
"app/controllers/clearance/confirmations_controller.rb",
|
22
21
|
"app/controllers/clearance/passwords_controller.rb",
|
23
22
|
"app/controllers/clearance/sessions_controller.rb",
|
24
23
|
"app/controllers/clearance/users_controller.rb",
|
25
24
|
"app/models/clearance_mailer.rb",
|
26
25
|
"app/views/clearance_mailer/change_password.html.erb",
|
27
|
-
"app/views/clearance_mailer/confirmation.html.erb",
|
28
26
|
"app/views/passwords/edit.html.erb",
|
29
27
|
"app/views/passwords/new.html.erb",
|
30
28
|
"app/views/sessions/new.html.erb",
|
@@ -94,13 +92,7 @@ Gem::Specification.new do |s|
|
|
94
92
|
"spec/rails_root/config/initializers/session_store.rb",
|
95
93
|
"spec/rails_root/config/locales/en.yml",
|
96
94
|
"spec/rails_root/config/routes.rb",
|
97
|
-
"spec/rails_root/db/schema.rb",
|
98
95
|
"spec/rails_root/doc/README_FOR_APP",
|
99
|
-
"spec/rails_root/features/password_reset.feature",
|
100
|
-
"spec/rails_root/features/sign_in.feature",
|
101
|
-
"spec/rails_root/features/sign_out.feature",
|
102
|
-
"spec/rails_root/features/sign_up.feature",
|
103
|
-
"spec/rails_root/features/step_definitions/clearance_steps.rb",
|
104
96
|
"spec/rails_root/features/step_definitions/web_steps.rb",
|
105
97
|
"spec/rails_root/features/support/env.rb",
|
106
98
|
"spec/rails_root/features/support/paths.rb",
|
@@ -128,7 +120,6 @@ Gem::Specification.new do |s|
|
|
128
120
|
"spec/rails_root/vendor/plugins/dynamic_form/test/dynamic_form_i18n_test.rb",
|
129
121
|
"spec/rails_root/vendor/plugins/dynamic_form/test/dynamic_form_test.rb",
|
130
122
|
"spec/rails_root/vendor/plugins/dynamic_form/test/test_helper.rb",
|
131
|
-
"test/controllers/confirmations_controller_test.rb",
|
132
123
|
"test/controllers/passwords_controller_test.rb",
|
133
124
|
"test/controllers/sessions_controller_test.rb",
|
134
125
|
"test/controllers/users_controller_test.rb",
|
@@ -196,7 +187,8 @@ Gem::Specification.new do |s|
|
|
196
187
|
]
|
197
188
|
|
198
189
|
s.add_dependency('rails', '~>3.0.0')
|
199
|
-
s.add_development_dependency('rspec',
|
190
|
+
s.add_development_dependency('rspec', '~> 1.3.0')
|
191
|
+
s.add_development_dependency('cucumber', '0.10.0')
|
200
192
|
|
201
193
|
if s.respond_to? :specification_version then
|
202
194
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
data/config/routes.rb
CHANGED
@@ -11,10 +11,6 @@ Rails.application.routes.draw do
|
|
11
11
|
resource :password,
|
12
12
|
:controller => 'clearance/passwords',
|
13
13
|
:only => [:create, :edit, :update]
|
14
|
-
|
15
|
-
resource :confirmation,
|
16
|
-
:controller => 'clearance/confirmations',
|
17
|
-
:only => [:new, :create]
|
18
14
|
end
|
19
15
|
|
20
16
|
match 'sign_up' => 'clearance/users#new', :as => 'sign_up'
|
@@ -16,16 +16,8 @@ module Clearance
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def should_be_signed_in_and_email_confirmed_as(&block)
|
19
|
-
warn "[DEPRECATION] should_be_signed_in_and_email_confirmed_as:
|
19
|
+
warn "[DEPRECATION] should_be_signed_in_and_email_confirmed_as: email confirmation is gone"
|
20
20
|
should_be_signed_in_as &block
|
21
|
-
|
22
|
-
should "have confirmed email" do
|
23
|
-
user = block.bind(self).call
|
24
|
-
|
25
|
-
assert_not_nil user
|
26
|
-
assert_equal user, assigns(:user)
|
27
|
-
assert assigns(:user).email_confirmed?
|
28
|
-
end
|
29
21
|
end
|
30
22
|
|
31
23
|
def should_not_be_signed_in
|
data/lib/clearance/user.rb
CHANGED
@@ -50,7 +50,7 @@ module Clearance
|
|
50
50
|
model.class_eval do
|
51
51
|
validates_presence_of :email, :unless => :email_optional?
|
52
52
|
validates_uniqueness_of :email, :case_sensitive => false, :allow_blank => true
|
53
|
-
validates_format_of :email, :with => %r{
|
53
|
+
validates_format_of :email, :with => %r{^[a-z0-9!#\$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#\$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$}i, :allow_blank => true
|
54
54
|
|
55
55
|
validates_presence_of :password, :unless => :password_optional?
|
56
56
|
validates_confirmation_of :password
|
@@ -66,9 +66,7 @@ module Clearance
|
|
66
66
|
model.class_eval do
|
67
67
|
before_save :initialize_salt,
|
68
68
|
:encrypt_password
|
69
|
-
before_create :
|
70
|
-
:generate_remember_token
|
71
|
-
after_create :send_confirmation_email, :unless => :email_confirmed?
|
69
|
+
before_create :generate_remember_token
|
72
70
|
end
|
73
71
|
end
|
74
72
|
end
|
@@ -101,16 +99,6 @@ module Clearance
|
|
101
99
|
save(:validate => false)
|
102
100
|
end
|
103
101
|
|
104
|
-
# Confirm my email.
|
105
|
-
#
|
106
|
-
# @example
|
107
|
-
# user.confirm_email!
|
108
|
-
def confirm_email!
|
109
|
-
self.email_confirmed = true
|
110
|
-
self.confirmation_token = nil
|
111
|
-
save(:validate => false)
|
112
|
-
end
|
113
|
-
|
114
102
|
# Mark my account as forgotten password.
|
115
103
|
#
|
116
104
|
# @example
|
@@ -183,10 +171,6 @@ module Clearance
|
|
183
171
|
# warn "[DEPRECATION] password_required?: use !password_optional? instead"
|
184
172
|
!password_optional?
|
185
173
|
end
|
186
|
-
|
187
|
-
def send_confirmation_email
|
188
|
-
ClearanceMailer.confirmation(self).deliver
|
189
|
-
end
|
190
174
|
end
|
191
175
|
|
192
176
|
module ClassMethods
|
@@ -16,6 +16,9 @@ Feature: Password reset
|
|
16
16
|
|
17
17
|
Scenario: User is signed up updated his password and types wrong confirmation
|
18
18
|
Given I signed up with "email@person.com/password"
|
19
|
+
And I go to the password reset request page
|
20
|
+
And I fill in "Email address" with "email@person.com"
|
21
|
+
And I press "Reset password"
|
19
22
|
When I follow the password reset link sent to "email@person.com"
|
20
23
|
And I update my password with "newpassword/wrongconfirmation"
|
21
24
|
Then I should see an error message
|
@@ -23,6 +26,9 @@ Feature: Password reset
|
|
23
26
|
|
24
27
|
Scenario: User is signed up and updates his password
|
25
28
|
Given I signed up with "email@person.com/password"
|
29
|
+
And I go to the password reset request page
|
30
|
+
And I fill in "Email address" with "email@person.com"
|
31
|
+
And I press "Reset password"
|
26
32
|
When I follow the password reset link sent to "email@person.com"
|
27
33
|
And I update my password with "newpassword/newpassword"
|
28
34
|
Then I should be signed in
|
@@ -10,26 +10,18 @@ Feature: Sign in
|
|
10
10
|
Then I should see "Bad email or password"
|
11
11
|
And I should be signed out
|
12
12
|
|
13
|
-
Scenario: User is not confirmed
|
14
|
-
Given I signed up with "email@person.com/password"
|
15
|
-
When I go to the sign in page
|
16
|
-
And I sign in as "email@person.com/password"
|
17
|
-
Then I should see "User has not confirmed email"
|
18
|
-
And I should be signed out
|
19
|
-
|
20
13
|
Scenario: User enters wrong password
|
21
|
-
Given I am signed up
|
14
|
+
Given I am signed up as "email@person.com/password"
|
22
15
|
When I go to the sign in page
|
23
16
|
And I sign in as "email@person.com/wrongpassword"
|
24
17
|
Then I should see "Bad email or password"
|
25
18
|
And I should be signed out
|
26
19
|
|
27
20
|
Scenario: User signs in successfully
|
28
|
-
Given I am signed up
|
21
|
+
Given I am signed up as "email@person.com/password"
|
29
22
|
When I go to the sign in page
|
30
23
|
And I sign in as "email@person.com/password"
|
31
24
|
Then I should see "Signed in"
|
32
25
|
And I should be signed in
|
33
26
|
When I return next time
|
34
27
|
Then I should be signed in
|
35
|
-
|
@@ -4,7 +4,7 @@ Feature: Sign out
|
|
4
4
|
Should be able to sign out
|
5
5
|
|
6
6
|
Scenario: User signs out
|
7
|
-
Given I am signed up
|
7
|
+
Given I am signed up as "email@person.com/password"
|
8
8
|
When I sign in as "email@person.com/password"
|
9
9
|
Then I should be signed in
|
10
10
|
And I sign out
|
@@ -17,29 +17,4 @@ Feature: Sign up
|
|
17
17
|
And I fill in "Password" with "password"
|
18
18
|
And I fill in "Confirm password" with "password"
|
19
19
|
And I press "Sign up"
|
20
|
-
Then I should see "
|
21
|
-
And a confirmation message should be sent to "email@person.com"
|
22
|
-
|
23
|
-
Scenario: User confirms his account
|
24
|
-
Given I signed up with "email@person.com/password"
|
25
|
-
When I follow the confirmation link sent to "email@person.com"
|
26
|
-
Then I should see "Confirmed email and signed in"
|
27
|
-
And I should be signed in
|
28
|
-
|
29
|
-
Scenario: Signed in user clicks confirmation link again
|
30
|
-
Given I signed up with "email@person.com/password"
|
31
|
-
When I follow the confirmation link sent to "email@person.com"
|
32
|
-
Then I should be signed in
|
33
|
-
When I follow the confirmation link sent to "email@person.com"
|
34
|
-
Then I should see "Confirmed email and signed in"
|
35
|
-
And I should be signed in
|
36
|
-
|
37
|
-
Scenario: Signed out user clicks confirmation link again
|
38
|
-
Given I signed up with "email@person.com/password"
|
39
|
-
When I follow the confirmation link sent to "email@person.com"
|
40
|
-
Then I should be signed in
|
41
|
-
When I sign out
|
42
|
-
And I follow the confirmation link sent to "email@person.com"
|
43
|
-
Then I should see "Already confirmed email. Please sign in."
|
44
|
-
And I should be signed out
|
45
|
-
|
20
|
+
Then I should see "signed up"
|
data/lib/rails/generators/clearance_features_templates/features/step_definitions/clearance_steps.rb
CHANGED
@@ -15,17 +15,14 @@ Given /^no user exists with an email of "(.*)"$/ do |email|
|
|
15
15
|
end
|
16
16
|
|
17
17
|
Given /^I signed up with "(.*)\/(.*)"$/ do |email, password|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
Factory(:user,
|
19
|
+
:email => email,
|
20
|
+
:password => password,
|
21
|
+
:password_confirmation => password)
|
22
22
|
end
|
23
23
|
|
24
|
-
Given /^I am signed up
|
25
|
-
|
26
|
-
:email => email,
|
27
|
-
:password => password,
|
28
|
-
:password_confirmation => password
|
24
|
+
Given /^I am signed up as "([^"]+)"$/ do |email_password|
|
25
|
+
Given %{I signed up with "#{email_password}"}
|
29
26
|
end
|
30
27
|
|
31
28
|
# Session
|
@@ -48,7 +45,7 @@ When /^session is cleared$/ do
|
|
48
45
|
end
|
49
46
|
|
50
47
|
Given /^I have signed in with "(.*)\/(.*)"$/ do |email, password|
|
51
|
-
Given %{I am signed up
|
48
|
+
Given %{I am signed up as "#{email}/#{password}"}
|
52
49
|
And %{I sign in as "#{email}/#{password}"}
|
53
50
|
end
|
54
51
|
|
@@ -59,24 +56,6 @@ end
|
|
59
56
|
|
60
57
|
# Emails
|
61
58
|
|
62
|
-
Then /^a confirmation message should be sent to "(.*)"$/ do |email|
|
63
|
-
user = User.find_by_email(email)
|
64
|
-
assert !user.confirmation_token.blank?
|
65
|
-
assert !ActionMailer::Base.deliveries.empty?
|
66
|
-
result = ActionMailer::Base.deliveries.any? do |email|
|
67
|
-
email.to == [user.email] &&
|
68
|
-
email.subject =~ /confirm/i &&
|
69
|
-
email.body =~ /#{user.confirmation_token}/
|
70
|
-
end
|
71
|
-
assert result
|
72
|
-
end
|
73
|
-
|
74
|
-
When /^I follow the confirmation link sent to "(.*)"$/ do |email|
|
75
|
-
user = User.find_by_email(email)
|
76
|
-
visit new_user_confirmation_path(:user_id => user,
|
77
|
-
:token => user.confirmation_token)
|
78
|
-
end
|
79
|
-
|
80
59
|
Then /^a password reset message should be sent to "(.*)"$/ do |email|
|
81
60
|
user = User.find_by_email(email)
|
82
61
|
assert !user.confirmation_token.blank?
|