devise 2.2.3 → 2.2.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of devise might be problematic. Click here for more details.

Files changed (66) hide show
  1. checksums.yaml +15 -0
  2. data/.travis.yml +0 -7
  3. data/.yardopts +9 -0
  4. data/CHANGELOG.rdoc +18 -0
  5. data/Gemfile +4 -4
  6. data/Gemfile.lock +57 -57
  7. data/README.md +8 -4
  8. data/Rakefile +1 -0
  9. data/app/controllers/devise/confirmations_controller.rb +1 -1
  10. data/app/controllers/devise/passwords_controller.rb +5 -2
  11. data/app/controllers/devise/sessions_controller.rb +0 -1
  12. data/app/controllers/devise/unlocks_controller.rb +2 -2
  13. data/app/controllers/devise_controller.rb +9 -4
  14. data/app/views/devise/registrations/edit.html.erb +1 -1
  15. data/devise.gemspec +1 -0
  16. data/devise.png +0 -0
  17. data/gemfiles/Gemfile.rails-3.1.x +4 -4
  18. data/gemfiles/Gemfile.rails-3.1.x.lock +56 -56
  19. data/lib/devise.rb +18 -2
  20. data/lib/devise/mailers/helpers.rb +5 -4
  21. data/lib/devise/models/authenticatable.rb +24 -8
  22. data/lib/devise/models/confirmable.rb +23 -3
  23. data/lib/devise/models/database_authenticatable.rb +15 -0
  24. data/lib/devise/models/omniauthable.rb +2 -2
  25. data/lib/devise/models/recoverable.rb +1 -1
  26. data/lib/devise/models/timeoutable.rb +1 -1
  27. data/lib/devise/param_filter.rb +8 -8
  28. data/lib/devise/rails/routes.rb +22 -17
  29. data/lib/devise/rails/warden_compat.rb +0 -29
  30. data/lib/devise/strategies/authenticatable.rb +8 -5
  31. data/lib/devise/strategies/token_authenticatable.rb +38 -3
  32. data/lib/devise/version.rb +1 -1
  33. data/lib/generators/devise/views_generator.rb +8 -2
  34. data/lib/generators/templates/devise.rb +10 -4
  35. data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +1 -1
  36. data/test/controllers/passwords_controller_test.rb +32 -0
  37. data/test/failure_app_test.rb +3 -3
  38. data/test/generators/views_generator_test.rb +16 -1
  39. data/test/helpers/devise_helper_test.rb +1 -1
  40. data/test/integration/authenticatable_test.rb +72 -25
  41. data/test/integration/confirmable_test.rb +6 -6
  42. data/test/integration/database_authenticatable_test.rb +1 -1
  43. data/test/integration/http_authenticatable_test.rb +19 -1
  44. data/test/integration/lockable_test.rb +1 -1
  45. data/test/integration/omniauthable_test.rb +2 -2
  46. data/test/integration/recoverable_test.rb +2 -2
  47. data/test/integration/registerable_test.rb +4 -4
  48. data/test/integration/rememberable_test.rb +9 -9
  49. data/test/integration/timeoutable_test.rb +1 -1
  50. data/test/integration/token_authenticatable_test.rb +45 -1
  51. data/test/integration/trackable_test.rb +1 -1
  52. data/test/mailers/confirmation_instructions_test.rb +11 -2
  53. data/test/mailers/reset_password_instructions_test.rb +11 -2
  54. data/test/mailers/unlock_instructions_test.rb +11 -1
  55. data/test/models/authenticatable_test.rb +3 -3
  56. data/test/models/confirmable_test.rb +17 -0
  57. data/test/models/database_authenticatable_test.rb +32 -0
  58. data/test/models/lockable_test.rb +1 -1
  59. data/test/models/rememberable_test.rb +4 -3
  60. data/test/models/serializable_test.rb +6 -6
  61. data/test/models/validatable_test.rb +3 -3
  62. data/test/models_test.rb +6 -1
  63. data/test/rails_app/app/mailers/users/mailer.rb +5 -1
  64. data/test/rails_app/config/routes.rb +13 -13
  65. data/test/test_helper.rb +1 -1
  66. metadata +23 -28
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class ConfirmationTest < ActionController::IntegrationTest
3
+ class ConfirmationTest < ActionDispatch::IntegrationTest
4
4
 
5
5
  def visit_user_confirmation_with_token(confirmation_token)
6
6
  visit user_confirmation_path(:confirmation_token => confirmation_token)
@@ -167,7 +167,7 @@ class ConfirmationTest < ActionController::IntegrationTest
167
167
  end
168
168
 
169
169
  test 'resent confirmation token with invalid E-Mail in XML format should return invalid response' do
170
- user = create_user(:confirm => false)
170
+ create_user(:confirm => false)
171
171
  post user_confirmation_path(:format => 'xml'), :user => { :email => 'invalid.test@test.com' }
172
172
  assert_response :unprocessable_entity
173
173
  assert response.body.include? %(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<errors>)
@@ -181,7 +181,7 @@ class ConfirmationTest < ActionController::IntegrationTest
181
181
  end
182
182
 
183
183
  test 'confirm account with invalid confirmation token in XML format should return invalid response' do
184
- user = create_user(:confirm => false)
184
+ create_user(:confirm => false)
185
185
  get user_confirmation_path(:confirmation_token => 'invalid_confirmation', :format => 'xml')
186
186
  assert_response :unprocessable_entity
187
187
  assert response.body.include? %(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<errors>)
@@ -226,7 +226,7 @@ class ConfirmationTest < ActionController::IntegrationTest
226
226
  end
227
227
  end
228
228
 
229
- class ConfirmationOnChangeTest < ActionController::IntegrationTest
229
+ class ConfirmationOnChangeTest < ActionDispatch::IntegrationTest
230
230
  def create_second_admin(options={})
231
231
  @admin = nil
232
232
  create_admin(options)
@@ -275,7 +275,7 @@ class ConfirmationOnChangeTest < ActionController::IntegrationTest
275
275
 
276
276
  visit_admin_confirmation_with_token(confirmation_token)
277
277
  assert_have_selector '#error_explanation'
278
- assert_contain /Confirmation token(.*)invalid/
278
+ assert_contain(/Confirmation token(.*)invalid/)
279
279
 
280
280
  visit_admin_confirmation_with_token(admin.confirmation_token)
281
281
  assert_contain 'Your account was successfully confirmed.'
@@ -293,7 +293,7 @@ class ConfirmationOnChangeTest < ActionController::IntegrationTest
293
293
 
294
294
  visit_admin_confirmation_with_token(admin.confirmation_token)
295
295
  assert_have_selector '#error_explanation'
296
- assert_contain /Email.*already.*taken/
296
+ assert_contain(/Email.*already.*taken/)
297
297
  assert admin.reload.pending_reconfirmation?
298
298
  end
299
299
  end
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class DatabaseAuthenticationTest < ActionController::IntegrationTest
3
+ class DatabaseAuthenticationTest < ActionDispatch::IntegrationTest
4
4
  test 'sign in with email of different case should succeed when email is in the list of case insensitive keys' do
5
5
  create_user(:email => 'Foo@Bar.com')
6
6
 
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class HttpAuthenticationTest < ActionController::IntegrationTest
3
+ class HttpAuthenticationTest < ActionDispatch::IntegrationTest
4
4
  test 'handles unverified requests gets rid of caches but continues signed in' do
5
5
  swap UsersController, :allow_forgery_protection => true do
6
6
  create_user
@@ -62,6 +62,24 @@ class HttpAuthenticationTest < ActionController::IntegrationTest
62
62
  end
63
63
  end
64
64
 
65
+ test 'it uses appropriate authentication_keys when configured with hash' do
66
+ swap Devise, :authentication_keys => ActiveSupport::OrderedHash[:username, false, :email, false] do
67
+ sign_in_as_new_user_with_http("usertest")
68
+ assert_response :success
69
+ assert_match '<email>user@test.com</email>', response.body
70
+ assert warden.authenticated?(:user)
71
+ end
72
+ end
73
+
74
+ test 'it uses the appropriate key when configured explicitly' do
75
+ swap Devise, :authentication_keys => ActiveSupport::OrderedHash[:email, false, :username, false], :http_authentication_key => :username do
76
+ sign_in_as_new_user_with_http("usertest")
77
+ assert_response :success
78
+ assert_match '<email>user@test.com</email>', response.body
79
+ assert warden.authenticated?(:user)
80
+ end
81
+ end
82
+
65
83
  test 'test request with oauth2 header doesnt get mistaken for basic authentication' do
66
84
  swap Devise, :http_authenticatable => true do
67
85
  add_oauth2_header
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class LockTest < ActionController::IntegrationTest
3
+ class LockTest < ActionDispatch::IntegrationTest
4
4
 
5
5
  def visit_user_unlock_with_token(unlock_token)
6
6
  visit user_unlock_path(:unlock_token => unlock_token)
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
 
4
- class OmniauthableIntegrationTest < ActionController::IntegrationTest
4
+ class OmniauthableIntegrationTest < ActionDispatch::IntegrationTest
5
5
  FACEBOOK_INFO = {
6
6
  "id" => '12345',
7
7
  "link" => 'http://facebook.com/josevalim',
@@ -90,7 +90,7 @@ class OmniauthableIntegrationTest < ActionController::IntegrationTest
90
90
  end
91
91
 
92
92
  assert session["devise.facebook_data"]
93
- user = sign_in_as_user
93
+ sign_in_as_user
94
94
  assert !session["devise.facebook_data"]
95
95
  end
96
96
 
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class PasswordTest < ActionController::IntegrationTest
3
+ class PasswordTest < ActionDispatch::IntegrationTest
4
4
 
5
5
  def visit_new_password_path
6
6
  visit new_user_session_path
@@ -270,7 +270,7 @@ class PasswordTest < ActionController::IntegrationTest
270
270
  end
271
271
 
272
272
  test 'change password with invalid token in XML format should return invalid response' do
273
- user = create_user
273
+ create_user
274
274
  request_forgot_password
275
275
  put user_password_path(:format => 'xml'), :user => {:reset_password_token => 'invalid.token', :password => '987654321', :password_confirmation => '987654321'}
276
276
  assert_response :unprocessable_entity
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class RegistrationTest < ActionController::IntegrationTest
3
+ class RegistrationTest < ActionDispatch::IntegrationTest
4
4
 
5
5
  test 'a guest admin should be able to sign in successfully' do
6
6
  get new_admin_session_path
@@ -112,7 +112,7 @@ class RegistrationTest < ActionController::IntegrationTest
112
112
  # https://github.com/mongoid/mongoid/issues/756
113
113
  (pending "Fails on Mongoid < 2.1"; break) if defined?(Mongoid) && Mongoid::VERSION.to_f < 2.1
114
114
 
115
- user = create_user
115
+ create_user
116
116
  get new_user_registration_path
117
117
 
118
118
  fill_in 'email', :with => 'user@test.com'
@@ -285,14 +285,14 @@ class RegistrationTest < ActionController::IntegrationTest
285
285
  end
286
286
 
287
287
  test 'a user cancel his account in XML format should return valid response' do
288
- user = sign_in_as_user
288
+ sign_in_as_user
289
289
  delete user_registration_path(:format => 'xml')
290
290
  assert_response :success
291
291
  assert_equal User.count, 0
292
292
  end
293
293
  end
294
294
 
295
- class ReconfirmableRegistrationTest < ActionController::IntegrationTest
295
+ class ReconfirmableRegistrationTest < ActionDispatch::IntegrationTest
296
296
  test 'a signed in admin should see a more appropriate flash message when editing his account if reconfirmable is enabled' do
297
297
  sign_in_as_admin
298
298
  get edit_admin_registration_path
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class RememberMeTest < ActionController::IntegrationTest
3
+ class RememberMeTest < ActionDispatch::IntegrationTest
4
4
  def create_user_and_remember(add_to_token='')
5
5
  user = create_user
6
6
  user.remember_me!
@@ -26,7 +26,7 @@ class RememberMeTest < ActionController::IntegrationTest
26
26
  end
27
27
 
28
28
  test 'do not remember the user if he has not checked remember me option' do
29
- user = sign_in_as_user
29
+ sign_in_as_user
30
30
  assert_nil request.cookies["remember_user_cookie"]
31
31
  end
32
32
 
@@ -43,7 +43,7 @@ class RememberMeTest < ActionController::IntegrationTest
43
43
  end
44
44
 
45
45
  test 'generate remember token after sign in' do
46
- user = sign_in_as_user :remember_me => true
46
+ sign_in_as_user :remember_me => true
47
47
  assert request.cookies["remember_user_token"]
48
48
  end
49
49
 
@@ -84,7 +84,7 @@ class RememberMeTest < ActionController::IntegrationTest
84
84
  end
85
85
 
86
86
  test 'remember the user before sign up and redirect him to his home' do
87
- user = create_user_and_remember
87
+ create_user_and_remember
88
88
  get new_user_registration_path
89
89
  assert warden.authenticated?(:user)
90
90
  assert_redirected_to root_path
@@ -92,7 +92,7 @@ class RememberMeTest < ActionController::IntegrationTest
92
92
 
93
93
  test 'cookies are destroyed on unverified requests' do
94
94
  swap ApplicationController, :allow_forgery_protection => true do
95
- user = create_user_and_remember
95
+ create_user_and_remember
96
96
  get users_path
97
97
  assert warden.authenticated?(:user)
98
98
  post root_path, :authenticity_token => 'INVALID'
@@ -117,7 +117,7 @@ class RememberMeTest < ActionController::IntegrationTest
117
117
  end
118
118
 
119
119
  test 'do not remember other scopes' do
120
- user = create_user_and_remember
120
+ create_user_and_remember
121
121
  get root_path
122
122
  assert_response :success
123
123
  assert warden.authenticated?(:user)
@@ -125,14 +125,14 @@ class RememberMeTest < ActionController::IntegrationTest
125
125
  end
126
126
 
127
127
  test 'do not remember with invalid token' do
128
- user = create_user_and_remember('add')
128
+ create_user_and_remember('add')
129
129
  get users_path
130
130
  assert_not warden.authenticated?(:user)
131
131
  assert_redirected_to new_user_session_path
132
132
  end
133
133
 
134
134
  test 'do not remember with expired token' do
135
- user = create_user_and_remember
135
+ create_user_and_remember
136
136
  swap Devise, :remember_for => 0 do
137
137
  get users_path
138
138
  assert_not warden.authenticated?(:user)
@@ -141,7 +141,7 @@ class RememberMeTest < ActionController::IntegrationTest
141
141
  end
142
142
 
143
143
  test 'do not remember the user anymore after forget' do
144
- user = create_user_and_remember
144
+ create_user_and_remember
145
145
  get users_path
146
146
  assert warden.authenticated?(:user)
147
147
 
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class SessionTimeoutTest < ActionController::IntegrationTest
3
+ class SessionTimeoutTest < ActionDispatch::IntegrationTest
4
4
 
5
5
  def last_request_at
6
6
  @controller.user_session['last_request_at']
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class TokenAuthenticationTest < ActionController::IntegrationTest
3
+ class TokenAuthenticationTest < ActionDispatch::IntegrationTest
4
4
 
5
5
  test 'authenticate with valid authentication token key and value through params' do
6
6
  swap Devise, :token_authentication_key => :secret_token do
@@ -129,6 +129,46 @@ class TokenAuthenticationTest < ActionController::IntegrationTest
129
129
  end
130
130
  end
131
131
 
132
+ test 'authenticate with valid authentication token key and value through http header' do
133
+ swap Devise, :token_authentication_key => :secret_token do
134
+ sign_in_as_new_user_with_token(:token_auth => true)
135
+
136
+ assert_response :success
137
+ assert_match '<email>user@test.com</email>', response.body
138
+ assert_equal request.env['devise.token_options'], {}
139
+ assert warden.authenticated?(:user)
140
+ end
141
+ end
142
+
143
+ test 'authenticate with valid authentication token key and value through http header, with options' do
144
+ swap Devise, :token_authentication_key => :secret_token, :http_authenticatable => [:token_options] do
145
+ signature = "**TESTSIGNATURE**"
146
+ sign_in_as_new_user_with_token(:token_auth => true, :token_options => {:signature => signature, :nonce => 'def'})
147
+
148
+ assert_response :success
149
+ assert_match '<email>user@test.com</email>', response.body
150
+ assert_equal request.env['devise.token_options'][:signature], signature
151
+ assert_equal request.env['devise.token_options'][:nonce], 'def'
152
+ assert warden.authenticated?(:user)
153
+ end
154
+ end
155
+
156
+ test 'authenticate with valid authentication token key and value through http header without allowing token authorization setting is denied' do
157
+ swap Devise, :token_authentication_key => :secret_token, :http_authenticatable => false do
158
+ sign_in_as_new_user_with_token(:token_auth => true)
159
+
160
+ assert_response :unauthorized
161
+ assert_nil warden.user(:user)
162
+ end
163
+ end
164
+
165
+ test 'does not authenticate with improper authentication token value in header' do
166
+ sign_in_as_new_user_with_token(:token_auth => true, :auth_token => '*** INVALID TOKEN ***')
167
+
168
+ assert_response :unauthorized
169
+ assert_nil warden.user(:user)
170
+ end
171
+
132
172
  private
133
173
 
134
174
  def sign_in_as_new_user_with_token(options = {})
@@ -140,6 +180,10 @@ class TokenAuthenticationTest < ActionController::IntegrationTest
140
180
  if options[:http_auth]
141
181
  header = "Basic #{Base64.encode64("#{VALID_AUTHENTICATION_TOKEN}:X")}"
142
182
  get users_path(:format => :xml), {}, "HTTP_AUTHORIZATION" => header
183
+ elsif options[:token_auth]
184
+ token_options = options[:token_options] || {}
185
+ header = ActionController::HttpAuthentication::Token.encode_credentials(options[:auth_token], token_options)
186
+ get users_path(:format => :xml), {}, "HTTP_AUTHORIZATION" => header
143
187
  else
144
188
  visit users_path(options[:auth_token_key].to_sym => options[:auth_token])
145
189
  end
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class TrackableHooksTest < ActionController::IntegrationTest
3
+ class TrackableHooksTest < ActionDispatch::IntegrationTest
4
4
 
5
5
  test "current and last sign in timestamps are updated on each sign in" do
6
6
  user = create_user
@@ -46,6 +46,16 @@ class ConfirmationInstructionsTest < ActionMailer::TestCase
46
46
  assert_equal ['custom@example.com'], mail.from
47
47
  end
48
48
 
49
+ test 'setup sender from custom mailer defaults with proc' do
50
+ Devise.mailer = 'Users::FromProcMailer'
51
+ assert_equal ['custom@example.com'], mail.from
52
+ end
53
+
54
+ test 'custom mailer renders parent mailer template' do
55
+ Devise.mailer = 'Users::Mailer'
56
+ assert_not_blank mail.body.encoded
57
+ end
58
+
49
59
  test 'setup reply to as copy from sender' do
50
60
  assert_equal ['test@example.com'], mail.reply_to
51
61
  end
@@ -56,7 +66,6 @@ class ConfirmationInstructionsTest < ActionMailer::TestCase
56
66
  assert_equal ['custom_reply_to@example.com'], mail.reply_to
57
67
  end
58
68
 
59
-
60
69
  test 'setup subject from I18n' do
61
70
  store_translations :en, :devise => { :mailer => { :confirmation_instructions => { :subject => 'Account Confirmation' } } } do
62
71
  assert_equal 'Account Confirmation', mail.subject
@@ -70,7 +79,7 @@ class ConfirmationInstructionsTest < ActionMailer::TestCase
70
79
  end
71
80
 
72
81
  test 'body should have user info' do
73
- assert_match /#{user.email}/, mail.body.encoded
82
+ assert_match user.email, mail.body.encoded
74
83
  end
75
84
 
76
85
  test 'body should have link to confirm the account' do
@@ -1,7 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class ResetPasswordInstructionsTest < ActionMailer::TestCase
4
-
5
4
  def setup
6
5
  setup_mailer
7
6
  Devise.mailer = 'Devise::Mailer'
@@ -49,6 +48,16 @@ class ResetPasswordInstructionsTest < ActionMailer::TestCase
49
48
  assert_equal ['custom@example.com'], mail.from
50
49
  end
51
50
 
51
+ test 'setup sender from custom mailer defaults with proc' do
52
+ Devise.mailer = 'Users::FromProcMailer'
53
+ assert_equal ['custom@example.com'], mail.from
54
+ end
55
+
56
+ test 'custom mailer renders parent mailer template' do
57
+ Devise.mailer = 'Users::Mailer'
58
+ assert_not_blank mail.body.encoded
59
+ end
60
+
52
61
  test 'setup reply to as copy from sender' do
53
62
  assert_equal ['test@example.com'], mail.reply_to
54
63
  end
@@ -66,7 +75,7 @@ class ResetPasswordInstructionsTest < ActionMailer::TestCase
66
75
  end
67
76
 
68
77
  test 'body should have user info' do
69
- assert_match(/#{user.email}/, mail.body.encoded)
78
+ assert_match user.email, mail.body.encoded
70
79
  end
71
80
 
72
81
  test 'body should have link to confirm the account' do
@@ -49,6 +49,16 @@ class UnlockInstructionsTest < ActionMailer::TestCase
49
49
  assert_equal ['custom@example.com'], mail.from
50
50
  end
51
51
 
52
+ test 'setup sender from custom mailer defaults with proc' do
53
+ Devise.mailer = 'Users::FromProcMailer'
54
+ assert_equal ['custom@example.com'], mail.from
55
+ end
56
+
57
+ test 'custom mailer renders parent mailer template' do
58
+ Devise.mailer = 'Users::Mailer'
59
+ assert_not_blank mail.body.encoded
60
+ end
61
+
52
62
  test 'setup reply to as copy from sender' do
53
63
  assert_equal ['test@example.com'], mail.reply_to
54
64
  end
@@ -66,7 +76,7 @@ class UnlockInstructionsTest < ActionMailer::TestCase
66
76
  end
67
77
 
68
78
  test 'body should have user info' do
69
- assert_match(/#{user.email}/, mail.body.encoded)
79
+ assert_match user.email, mail.body.encoded
70
80
  end
71
81
 
72
82
  test 'body should have link to unlock the account' do
@@ -6,8 +6,8 @@ class AuthenticatableTest < ActiveSupport::TestCase
6
6
  end
7
7
 
8
8
  test 'find_first_by_auth_conditions allows custom filtering parameters' do
9
- user = User.create!(email: "example@example.com", password: "123456")
10
- assert_equal User.find_first_by_auth_conditions({ email: "example@example.com" }), user
11
- assert_equal User.find_first_by_auth_conditions({ email: "example@example.com" }, id: user.id + 1), nil
9
+ user = User.create!(:email => "example@example.com", :password => "123456")
10
+ assert_equal User.find_first_by_auth_conditions({ :email => "example@example.com" }), user
11
+ assert_nil User.find_first_by_auth_conditions({ :email => "example@example.com" }, :id => user.id.to_s.next)
12
12
  end
13
13
  end
@@ -104,6 +104,16 @@ class ConfirmableTest < ActiveSupport::TestCase
104
104
  end
105
105
  end
106
106
 
107
+ test 'should skip confirmation e-mail without confirming if skip_confirmation_notification! is invoked' do
108
+ user = new_user
109
+ user.skip_confirmation_notification!
110
+
111
+ assert_email_not_sent do
112
+ user.save!
113
+ assert !user.confirmed?
114
+ end
115
+ end
116
+
107
117
  test 'should find a user to send confirmation instructions' do
108
118
  user = create_user
109
119
  confirmation_user = User.send_confirmation_instructions(:email => user.email)
@@ -204,6 +214,13 @@ class ConfirmableTest < ActiveSupport::TestCase
204
214
  assert_not user.active_for_authentication?
205
215
  end
206
216
 
217
+ test 'should be active when we set allow_unconfirmed_access_for to nil' do
218
+ Devise.allow_unconfirmed_access_for = nil
219
+ user = create_user
220
+ user.confirmation_sent_at = Date.today
221
+ assert user.active_for_authentication?
222
+ end
223
+
207
224
  test 'should not be active without confirmation' do
208
225
  user = create_user
209
226
  user.confirmation_sent_at = nil