aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-01-13 14:01:17 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-01-13 14:01:17 +0000
commit1d61071e7cba0d14a0f1a66b21d4af3656104e02 (patch)
treedafa075b789259ab8e8684ce3c2fef1cf8e0b8e2 /actionpack
parent4cee51e1ccb592926e3d6e444d092ae7000531b0 (diff)
downloadrails-1d61071e7cba0d14a0f1a66b21d4af3656104e02.tar.gz
rails-1d61071e7cba0d14a0f1a66b21d4af3656104e02.tar.bz2
rails-1d61071e7cba0d14a0f1a66b21d4af3656104e02.zip
Fixed that controller tests can now assert on the use of cookies #466 [Alexey]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@402 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG2
-rw-r--r--actionpack/lib/action_controller/test_process.rb9
2 files changed, 11 insertions, 0 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 2cd5abeda8..2923232021 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Fixed that controller tests can now assert on the use of cookies #466 [Alexey]
+
* Fixed that send_file would "remember" all the files sent by adding to the headers again and again #458 [bitsweat]
* Fixed url rewriter confusion when the controller or action name was a substring of the controller_prefix or action_prefix
diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb
index f49b2dd3bf..6fd5249836 100644
--- a/actionpack/lib/action_controller/test_process.rb
+++ b/actionpack/lib/action_controller/test_process.rb
@@ -182,6 +182,15 @@ module ActionController #:nodoc:
def has_template_object?(name=nil)
!template_objects[name].nil?
end
+
+ # Returns the response cookies, converted to a Hash of (name => CGI::Cookie) pairs
+ # Example:
+ #
+ # assert_equal ['AuthorOfNewPage'], r.cookies['author'].value
+ def cookies
+ headers['cookie'].inject({}) { |hash, cookie| hash[cookie.name] = cookie; hash }
+ end
+
end
class TestSession #:nodoc: