mirror of
https://github.com/heartcombo/devise.git
synced 2026-04-28 03:00:29 -04:00
Renamed confirm_in to confirm_within.
This commit is contained in:
@@ -31,7 +31,7 @@ end
|
||||
class Configurable < User
|
||||
devise :all, :stretches => 15,
|
||||
:pepper => 'abcdef',
|
||||
:confirm_in => 5.days,
|
||||
:confirm_within => 5.days,
|
||||
:remember_for => 7.days
|
||||
end
|
||||
|
||||
@@ -97,8 +97,8 @@ class ActiveRecordTest < ActiveSupport::TestCase
|
||||
assert_equal 'abcdef', Configurable.new.pepper
|
||||
end
|
||||
|
||||
test 'set a default value for confirm_in' do
|
||||
assert_equal 5.days, Configurable.new.confirm_in
|
||||
test 'set a default value for confirm_within' do
|
||||
assert_equal 5.days, Configurable.new.confirm_within
|
||||
end
|
||||
|
||||
test 'set a default value for remember_for' do
|
||||
|
||||
@@ -59,7 +59,7 @@ class ConfirmationTest < ActionController::IntegrationTest
|
||||
end
|
||||
|
||||
test 'not confirmed user and setup to block without confirmation should not be able to sign in' do
|
||||
Devise.confirm_in = 0
|
||||
Devise.confirm_within = 0
|
||||
user = sign_in_as_user(:confirm => false)
|
||||
|
||||
assert_redirected_to new_user_session_path(:unconfirmed => true)
|
||||
@@ -67,7 +67,7 @@ class ConfirmationTest < ActionController::IntegrationTest
|
||||
end
|
||||
|
||||
test 'not confirmed user but configured with some days to confirm should be able to sign in' do
|
||||
Devise.confirm_in = 1
|
||||
Devise.confirm_within = 1
|
||||
user = sign_in_as_user(:confirm => false)
|
||||
|
||||
assert_response :success
|
||||
|
||||
@@ -194,20 +194,20 @@ class ConfirmableTest < ActiveSupport::TestCase
|
||||
|
||||
test 'confirm time should fallback to devise confirm in default configuration' do
|
||||
begin
|
||||
confirm_in = Devise.confirm_in
|
||||
Devise.confirm_in = 1.day
|
||||
confirm_within = Devise.confirm_within
|
||||
Devise.confirm_within = 1.day
|
||||
user = new_user
|
||||
user.confirmation_sent_at = 2.days.ago
|
||||
assert_not user.active?
|
||||
Devise.confirm_in = 3.days
|
||||
Devise.confirm_within = 3.days
|
||||
assert user.active?
|
||||
ensure
|
||||
Devise.confirm_in = confirm_in
|
||||
Devise.confirm_within = confirm_within
|
||||
end
|
||||
end
|
||||
|
||||
test 'should be active when confirmation sent at is not overpast' do
|
||||
Devise.confirm_in = 5.days
|
||||
Devise.confirm_within = 5.days
|
||||
user = create_user
|
||||
user.confirmation_sent_at = 4.days.ago
|
||||
assert user.active?
|
||||
@@ -223,21 +223,21 @@ class ConfirmableTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
test 'should not be active when confirmation was sent within the limit' do
|
||||
Devise.confirm_in = 5.days
|
||||
Devise.confirm_within = 5.days
|
||||
user = create_user
|
||||
user.confirmation_sent_at = 5.days.ago
|
||||
assert_not user.active?
|
||||
end
|
||||
|
||||
test 'should be active when confirm in is zero' do
|
||||
Devise.confirm_in = 0.days
|
||||
Devise.confirm_within = 0.days
|
||||
user = create_user
|
||||
user.confirmation_sent_at = Date.today
|
||||
assert_not user.active?
|
||||
end
|
||||
|
||||
test 'should not be active when confirmation was sent before confirm in time' do
|
||||
Devise.confirm_in = 4.days
|
||||
Devise.confirm_within = 4.days
|
||||
user = create_user
|
||||
user.confirmation_sent_at = 5.days.ago
|
||||
assert_not user.active?
|
||||
|
||||
Reference in New Issue
Block a user