From 07c494ae24b897bfa1d46f741b9ac14d3b480bc2 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 26 Oct 2005 13:14:10 +0000 Subject: Added a reader for flash.now, so it's possible to do stuff like flash.now[:alert] ||= 'New if not set' (closes #2422) [Caio Chassot] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2747 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/controller/flash_test.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'actionpack/test/controller/flash_test.rb') diff --git a/actionpack/test/controller/flash_test.rb b/actionpack/test/controller/flash_test.rb index 54a1444f97..2a14d6d625 100644 --- a/actionpack/test/controller/flash_test.rb +++ b/actionpack/test/controller/flash_test.rb @@ -9,6 +9,9 @@ class FlashTest < Test::Unit::TestCase def set_flash_now flash.now["that"] = "hello" + flash.now["foo"] ||= "bar" + flash.now["foo"] ||= "err" + @flashy = flash.now["that"] @flash_copy = {}.update flash render :inline => "hello" end @@ -75,10 +78,13 @@ class FlashTest < Test::Unit::TestCase @request.action = "set_flash_now" response = process_request assert_equal "hello", response.template.assigns["flash_copy"]["that"] + assert_equal "bar" , response.template.assigns["flash_copy"]["foo"] + assert_equal "hello", response.template.assigns["flashy"] @request.action = "attempt_to_use_flash_now" first_response = process_request assert_nil first_response.template.assigns["flash_copy"]["that"] + assert_nil first_response.template.assigns["flash_copy"]["foo"] assert_nil first_response.template.assigns["flashy"] end -- cgit v1.2.3