Add a plugin to handle session persistence. This is based on the
plugin at http://github.com/augustl/session-persistence but modified to work with rails 2 rather than rails 3.
This commit is contained in:
parent
345ac0bd1a
commit
60f145f13e
5 changed files with 134 additions and 0 deletions
41
vendor/plugins/session-persistence/test/session_timeout_test.rb
vendored
Normal file
41
vendor/plugins/session-persistence/test/session_timeout_test.rb
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
require "test/unit"
|
||||
|
||||
module ActionController
|
||||
class Base
|
||||
def self.after_filter(*args)
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
$LOAD_PATH.push(File.dirname(__FILE__) + "../lib")
|
||||
require "../init"
|
||||
|
||||
class SessionPersistenceTest < Test::Unit::TestCase
|
||||
def setup
|
||||
@controller = ActionController::Base.new
|
||||
@controller.instance_eval {
|
||||
def session
|
||||
@session ||= {}
|
||||
end
|
||||
|
||||
def session_persistence_key
|
||||
:mine
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
def test_session_expires_after
|
||||
@controller.instance_eval { session_expires_after 10 }
|
||||
assert_equal 10, @controller.session[:mine]
|
||||
end
|
||||
|
||||
def test_session_expires_automatically
|
||||
@controller.instance_eval {
|
||||
session_expires_after 10
|
||||
session_expires_automatically
|
||||
}
|
||||
|
||||
assert !@controller.session.has_key?(:mine)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue