1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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
This commit is contained in:
David Heinemeier Hansson 2005-01-17 23:24:47 +00:00
parent 1f7e72ff51
commit 6ca5eba396
2 changed files with 10 additions and 0 deletions

View file

@ -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

View file

@ -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 ---------------------------------------------------