diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 70a4c8dbd0c2c67ace85b7144d3c73130d6880fb..a4385088a9c63d6cc3dac6a4355204e7f29c55ff 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* TestSession supports indifferent access so session['foo'] == session[:foo] in your tests. #7372 [julik, jean.helou] + * Allow Routes to generate all urls for a set of options by specifying :generate_all => true. Allows caching to properly set or expire all paths for a resource. References #1739. [Nicholas Seckar] * Change the query parser to map empty GET params to "" rather than nil. Closes #5694. [Nicholas Seckar] diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb index beccec6f94459a9cf865482d97aae1006df0a4e0..1c319418b6eb62d8d967018da738aed60c5a826b 100644 --- a/actionpack/lib/action_controller/test_process.rb +++ b/actionpack/lib/action_controller/test_process.rb @@ -292,11 +292,11 @@ def data end def [](key) - data[key] + data[key.to_s] end def []=(key, value) - data[key] = value + data[key.to_s] = value end def update diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb index ab44fbf3ca34e2de967a0b12b2bdef9673c801de..4232863cdc8e6210dec3149e1b46722718d31737 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -8,6 +8,12 @@ def set_flash render :text => 'ignore me' end + def set_session + session['string'] = 'A wonder' + session[:symbol] = 'it works' + render :text => 'Success' + end + def render_raw_post raise Test::Unit::AssertionFailedError, "#raw_post is blank" if request.raw_post.blank? render :text => request.raw_post @@ -111,6 +117,14 @@ def test_process_with_flash assert_equal '>value<', flash['test'] end + def test_process_with_session + process :set_session + assert_equal 'A wonder', session['string'], "A value stored in the session should be available by string key" + assert_equal 'A wonder', session[:string], "Test session hash should allow indifferent access" + assert_equal 'it works', session['symbol'], "Test session hash should allow indifferent access" + assert_equal 'it works', session[:symbol], "Test session hash should allow indifferent access" + end + def test_process_with_request_uri_with_no_params process :test_uri assert_equal "/test_test/test/test_uri", @response.body