Renamed confirm_in to confirm_within.

This commit is contained in:
José Valim
2009-10-30 07:23:47 -02:00
parent 04b0622999
commit 3209e7d988
7 changed files with 49 additions and 40 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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?