aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorCraig Smith <craigsmith@reevoo.com>2009-06-05 14:58:38 +0100
committerMichael Koziarski <michael@koziarski.com>2009-10-15 10:58:55 +1300
commit316f4704eaa8aaba11e7ecebc1da9aa926fdd2d0 (patch)
tree2f6030053f62533550957050fc75dc21dd5cecb9 /actionpack/test/controller
parentfc46c9b2207c62d4b029c2c891c61fc660c0b627 (diff)
downloadrails-316f4704eaa8aaba11e7ecebc1da9aa926fdd2d0.tar.gz
rails-316f4704eaa8aaba11e7ecebc1da9aa926fdd2d0.tar.bz2
rails-316f4704eaa8aaba11e7ecebc1da9aa926fdd2d0.zip
Test cases should see all the cookies, not just cookies that have been set in the controller.
Previously this example would always pass, even when cookies.delete was not called. @request.cookies['foo'] = 'bar' get :delete_cookie assert_nil cookies['foo'] Signed-off-by: Michael Koziarski <michael@koziarski.com> [#2768 state:committed]
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/test_test.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb
index 73870a56bb..375878b755 100644
--- a/actionpack/test/controller/test_test.rb
+++ b/actionpack/test/controller/test_test.rb
@@ -108,6 +108,11 @@ XML
head :created, :location => 'created resource'
end
+ def delete_cookie
+ cookies.delete("foo")
+ render :nothing => true
+ end
+
private
def rescue_action(e)
raise e
@@ -512,6 +517,18 @@ XML
assert @request.params[:foo].blank?
end
+ def test_should_have_knowledge_of_client_side_cookie_state_even_if_they_are_not_set
+ @request.cookies['foo'] = 'bar'
+ get :no_op
+ assert_equal 'bar', cookies['foo']
+ end
+
+ def test_should_detect_if_cookie_is_deleted
+ @request.cookies['foo'] = 'bar'
+ get :delete_cookie
+ assert_nil cookies['foo']
+ end
+
%w(controller response request).each do |variable|
%w(get post put delete head process).each do |method|
define_method("test_#{variable}_missing_for_#{method}_raises_error") do