diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 30a1eb224a..68e3c5dd6d 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Added assert_cookie_equal to assert the contents of a named cookie + * Fixed bug in page caching that prevented it from working at all diff --git a/actionpack/lib/action_controller/assertions/action_pack_assertions.rb b/actionpack/lib/action_controller/assertions/action_pack_assertions.rb index 2cfbcbc938..5ffc0f90a1 100644 --- a/actionpack/lib/action_controller/assertions/action_pack_assertions.rb +++ b/actionpack/lib/action_controller/assertions/action_pack_assertions.rb @@ -60,6 +60,14 @@ module Test #:nodoc: msg = build_message(message, " expected in session['?'] but was ", expected, key, response.session[key]) assert_block(msg) { expected == response.session[key] } end + + # -- cookie assertions --------------------------------------------------- + + def assert_cookie_equal(expected = nil, key = nil, message = nil) + response = acquire_assertion_target + msg = build_message(message, " expected in cookies['?'] but was ", expected, key, response.cookies[key.to_s].first) + assert_block(msg) { expected == response.cookies[key.to_s].first } + end # -- flash assertions ---------------------------------------------------