summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-10-24 10:15:22 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-10-24 10:15:22 +0000
commit4cd22dcc5595f32519fbb43329e33106127c29b6 (patch)
tree8d8c35201924edfc5ab522e0193342390a94d212 /test/unit
parenta371c8d850a2d1941e34fcf908d549438fdf72df (diff)
downloadredmine-4cd22dcc5595f32519fbb43329e33106127c29b6.tar.gz
redmine-4cd22dcc5595f32519fbb43329e33106127c29b6.zip
Keep track of valid user sessions (#21058).
git-svn-id: http://svn.redmine.org/redmine/trunk@14735 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/token_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/unit/token_test.rb b/test/unit/token_test.rb
index 1d3c83703..95559c569 100644
--- a/test/unit/token_test.rb
+++ b/test/unit/token_test.rb
@@ -36,6 +36,19 @@ class TokenTest < ActiveSupport::TestCase
assert Token.exists?(t2.id)
end
+ def test_create_session_token_should_keep_last_10_tokens
+ Token.delete_all
+ user = User.find(1)
+
+ assert_difference 'Token.count', 10 do
+ 10.times { Token.create!(:user => user, :action => 'session') }
+ end
+
+ assert_no_difference 'Token.count' do
+ Token.create!(:user => user, :action => 'session')
+ end
+ end
+
def test_destroy_expired_should_not_destroy_feeds_and_api_tokens
Token.delete_all