]> git.openstreetmap.org Git - rails.git/blob - vendor/plugins/session-persistence/test/session_timeout_test.rb
Merge branch 'master' into openid
[rails.git] / vendor / plugins / session-persistence / test / session_timeout_test.rb
1 require "test/unit"
2
3 module ActionController
4   class Base
5     def self.after_filter(*args)
6       
7     end
8   end
9 end
10
11 $LOAD_PATH.push(File.dirname(__FILE__) + "../lib")
12 require "../init"
13
14 class SessionPersistenceTest < Test::Unit::TestCase
15   def setup
16     @controller = ActionController::Base.new
17     @controller.instance_eval {
18       def session
19         @session ||= {}
20       end
21       
22       def session_persistence_key
23         :mine
24       end
25     }
26   end
27   
28   def test_session_expires_after
29     @controller.instance_eval { session_expires_after 10 }
30     assert_equal 10, @controller.session[:mine]
31   end
32   
33   def test_session_expires_automatically
34     @controller.instance_eval {
35       session_expires_after 10
36       session_expires_automatically
37     }
38     
39     assert !@controller.session.has_key?(:mine)
40   end
41 end