From 1d61071e7cba0d14a0f1a66b21d4af3656104e02 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 13 Jan 2005 14:01:17 +0000 Subject: 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 --- actionpack/lib/action_controller/test_process.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'actionpack/lib/action_controller') 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: -- cgit v1.2.3