diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-01-28 18:24:46 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-01-28 18:24:46 +0000 |
commit | 09c708981ce058fe9b1cbead4fac9fbb58de6a97 (patch) | |
tree | 0b112a867a4720fcfdac51eb99e1e605f803ecb8 /actionpack/test | |
parent | 16f6bd4070d57fc1eacb1a531385af205233a573 (diff) | |
download | rails-09c708981ce058fe9b1cbead4fac9fbb58de6a97.tar.gz rails-09c708981ce058fe9b1cbead4fac9fbb58de6a97.tar.bz2 rails-09c708981ce058fe9b1cbead4fac9fbb58de6a97.zip |
TestSession supports indifferent access so session['foo'] == session[:foo] in your tests. Closes #7372.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6086 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/test_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb index ab44fbf3ca..4232863cdc 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -8,6 +8,12 @@ class TestTest < Test::Unit::TestCase 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 @@ HTML 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 |