diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-17 23:24:47 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-17 23:24:47 +0000 |
commit | 6ca5eba396c17e4f9bb4e8e5eab37eb8725b7714 (patch) | |
tree | f188216ac4ecb96e3a253ddb70406fe64af469da /actionpack | |
parent | 1f7e72ff519b7ff11986dbcd1ebe7a40f510ce90 (diff) | |
download | rails-6ca5eba396c17e4f9bb4e8e5eab37eb8725b7714.tar.gz rails-6ca5eba396c17e4f9bb4e8e5eab37eb8725b7714.tar.bz2 rails-6ca5eba396c17e4f9bb4e8e5eab37eb8725b7714.zip |
Added assert_cookie_equal to assert the contents of a named cookie
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@452 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rw-r--r-- | actionpack/lib/action_controller/assertions/action_pack_assertions.rb | 8 |
2 files changed, 10 insertions, 0 deletions
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 --------------------------------------------------- |