diff options
author | Kenny Ortmann <kenny.ortmann@gmail.com> | 2009-04-07 09:18:42 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-04-07 09:18:42 -0500 |
commit | f448c70b3f6c6698bce9c95fa4328c251fe085ee (patch) | |
tree | 322e3632d4a0604f571e3fff35a878f8371dd573 /actionpack/test/controller/request | |
parent | f209d3898fbd866e1405861319b85c97674a0508 (diff) | |
download | rails-f448c70b3f6c6698bce9c95fa4328c251fe085ee.tar.gz rails-f448c70b3f6c6698bce9c95fa4328c251fe085ee.tar.bz2 rails-f448c70b3f6c6698bce9c95fa4328c251fe085ee.zip |
added tests for session options being defaulted correctly to rack defaults [#2403 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'actionpack/test/controller/request')
-rw-r--r-- | actionpack/test/controller/request/test_request_test.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/actionpack/test/controller/request/test_request_test.rb b/actionpack/test/controller/request/test_request_test.rb new file mode 100644 index 0000000000..81551b4ba7 --- /dev/null +++ b/actionpack/test/controller/request/test_request_test.rb @@ -0,0 +1,35 @@ +require 'abstract_unit' +require 'stringio' + +class ActionController::TestRequestTest < ActiveSupport::TestCase + + def setup + @request = ActionController::TestRequest.new + end + + def test_test_request_has_session_options_initialized + assert @request.session_options + end + + Rack::Session::Abstract::ID::DEFAULT_OPTIONS.each_key do |option| + test "test_rack_default_session_options_#{option}_exists_in_session_options_and_is_default" do + assert_equal(Rack::Session::Abstract::ID::DEFAULT_OPTIONS[option], + @request.session_options[option], + "Missing rack session default option #{option} in request.session_options") + end + test "test_rack_default_session_options_#{option}_exists_in_session_options" do + assert(@request.session_options.has_key?(option), + "Missing rack session option #{option} in request.session_options") + end + end + + def test_session_id_exists_by_default + assert_not_nil(@request.session_options[:id]) + end + + def test_session_id_different_on_each_call + prev_id = + assert_not_equal(@request.session_options[:id], ActionController::TestRequest.new.session_options[:id]) + end + +end
\ No newline at end of file |