Skip to content

Commit

Permalink
Merge [6086] from trunk. References #7372.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/1-2-stable@6087 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
jeremy committed Jan 28, 2007
1 parent 57098ad commit 454842a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN* *SVN*


* TestSession supports indifferent access so session['foo'] == session[:foo] in your tests. #7372 [julik, jean.helou]

* select :multiple => true suffixes the attribute name with [] unless already suffixed. #6977 [nik.kakelin, ben, julik] * select :multiple => true suffixes the attribute name with [] unless already suffixed. #6977 [nik.kakelin, ben, julik]


* Improve routes documentation. #7095 [zackchandler] * Improve routes documentation. #7095 [zackchandler]
Expand Down
4 changes: 2 additions & 2 deletions actionpack/lib/action_controller/test_process.rb
Expand Up @@ -288,11 +288,11 @@ def data
end end


def [](key) def [](key)
data[key] data[key.to_s]
end end


def []=(key, value) def []=(key, value)
data[key] = value data[key.to_s] = value
end end


def update def update
Expand Down
14 changes: 14 additions & 0 deletions actionpack/test/controller/test_test.rb
Expand Up @@ -8,6 +8,12 @@ def set_flash
render :text => 'ignore me' render :text => 'ignore me'
end end


def set_session
session['string'] = 'A wonder'
session[:symbol] = 'it works'
render :text => 'Success'
end

def render_raw_post def render_raw_post
raise Test::Unit::AssertionFailedError, "#raw_post is blank" if request.raw_post.blank? raise Test::Unit::AssertionFailedError, "#raw_post is blank" if request.raw_post.blank?
render :text => request.raw_post render :text => request.raw_post
Expand Down Expand Up @@ -111,6 +117,14 @@ def test_process_with_flash
assert_equal '>value<', flash['test'] assert_equal '>value<', flash['test']
end 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 def test_process_with_request_uri_with_no_params
process :test_uri process :test_uri
assert_equal "/test_test/test/test_uri", @response.body assert_equal "/test_test/test/test_uri", @response.body
Expand Down

0 comments on commit 454842a

Please sign in to comment.