From 4cd22dcc5595f32519fbb43329e33106127c29b6 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 24 Oct 2015 10:15:22 +0000 Subject: Keep track of valid user sessions (#21058). git-svn-id: http://svn.redmine.org/redmine/trunk@14735 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/unit/token_test.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/unit') 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 -- cgit v1.2.3