From c031a0163356502392f1e6b2839eb248909f9def Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Wed, 17 Aug 2005 21:05:31 +0000 Subject: Add an :if option to session management, to allow programmatically enabling or disabling the session git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2031 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/controller/session_management_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/controller/session_management_test.rb b/actionpack/test/controller/session_management_test.rb index 707c4287f1..84cbd28387 100644 --- a/actionpack/test/controller/session_management_test.rb +++ b/actionpack/test/controller/session_management_test.rb @@ -16,6 +16,8 @@ class SessionManagementTest < Test::Unit::TestCase class TestController < ActionController::Base session :off, :only => :show session :session_secure => true, :except => :show + session :off, :only => :conditional, + :if => Proc.new { |r| r.parameters[:ws] } def show render_text "done" @@ -24,6 +26,10 @@ class SessionManagementTest < Test::Unit::TestCase def tell render_text "done" end + + def conditional + render_text ">>>#{params[:ws]}<<<" + end end class SpecializedController < SessionOffController @@ -67,4 +73,12 @@ class SessionManagementTest < Test::Unit::TestCase get :another assert_equal false, @request.session_options end + + def test_session_off_with_if + @controller = TestController.new + get :conditional + assert_instance_of Hash, @request.session_options + get :conditional, :ws => "ws" + assert_equal false, @request.session_options + end end -- cgit v1.2.3