Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

more tests for remember_across_browsers

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
commit aefcd537653ec48df11da1f6e72ce291b1cb81bb 1 parent 0eb9208
@trevorturk trevorturk authored josevalim committed
Showing with 33 additions and 0 deletions.
  1. +33 −0 test/models/rememberable_test.rb
View
33 test/models/rememberable_test.rb
@@ -140,4 +140,37 @@ class RememberableTest < ActiveSupport::TestCase
assert_equal token, user.remember_token
end
end
+
+ test 'if remember_across_browsers is false, remember_me! should create a new token if no token exists' do
+ swap Devise, :remember_across_browsers => false do
+ user = create_user
+ assert_equal nil, user.remember_token
+ user.remember_me!
+ assert_not_equal nil, user.remember_token
+ end
+ end
+
+ test 'if remember_across_browsers is false, remember_me! should create a new token if a token exists but has expired' do
+ swap Devise, :remember_across_browsers => false, :remember_for => 1.day do
+ user = create_user
+ user.remember_me!
+ user.remember_created_at = 2.days.ago
+ user.save
+ token = user.remember_token
+ user.remember_me!
+ assert_not_equal token, user.remember_token
+ end
+ end
+
+ test 'if remember_across_browsers is false, remember_me! should create a new token if a token exists and has not expired' do
+ swap Devise, :remember_across_browsers => false, :remember_for => 2.days do
+ user = create_user
+ user.remember_me!
+ user.remember_created_at = 1.day.ago
+ user.save
+ token = user.remember_token
+ user.remember_me!
+ assert_not_equal token, user.remember_token
+ end
+ end
end

0 comments on commit aefcd53

Please sign in to comment.
Something went wrong with that request. Please try again.