public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Fixed flash.now not being accessible in tests. Flash sweeping is now done before 
action processing instead after

Signed-off-by: Michael Koziarski <michael@koziarski.com>

[#10 state:resolved]
zargony (author)
Sat May 10 08:54:09 -0700 2008
NZKoz (committer)
Sat May 10 23:30:10 -0700 2008
commit  74eed6290e63111d1aad2b181692a84f4f040aea
tree    c135f4062dce31d8dabf39753f1a1256f4776d16
parent  a7ea06b4ebe252e258f83e7de945b4baa30ec3bc
...
28
29
30
31
32
33
34
...
166
167
168
169
170
171
172
173
 
174
175
176
...
28
29
30
 
31
32
33
...
165
166
167
 
 
 
 
 
168
169
170
171
0
@@ -28,7 +28,6 @@ module ActionController #:nodoc:
0
       base.class_eval do
0
         include InstanceMethods
0
         alias_method_chain :assign_shortcuts, :flash
0
-        alias_method_chain :process_cleanup,  :flash
0
         alias_method_chain :reset_session,    :flash
0
       end
0
     end
0
@@ -166,11 +165,7 @@ module ActionController #:nodoc:
0
         def assign_shortcuts_with_flash(request, response) #:nodoc:
0
           assign_shortcuts_without_flash(request, response)
0
           flash(:refresh)
0
-        end
0
-    
0
-        def process_cleanup_with_flash
0
-          flash.sweep if @_session
0
-          process_cleanup_without_flash
0
+          flash.sweep if @_session && !component_request?
0
         end
0
     end
0
   end
...
12
13
14
 
 
 
 
 
15
16
17
...
145
146
147
 
 
 
 
 
148
149
150
...
12
13
14
15
16
17
18
19
20
21
22
...
150
151
152
153
154
155
156
157
158
159
160
0
@@ -12,6 +12,11 @@ class TestTest < Test::Unit::TestCase
0
       render :text => 'ignore me'
0
     end
0
 
0
+    def set_flash_now
0
+      flash.now["test_now"] = ">#{flash["test_now"]}<"
0
+      render :text => 'ignore me'
0
+    end
0
+
0
     def set_session
0
       session['string'] = 'A wonder'
0
       session[:symbol] = 'it works'
0
@@ -145,6 +150,11 @@ XML
0
     assert_equal '>value<', flash['test']
0
   end
0
 
0
+  def test_process_with_flash_now
0
+    process :set_flash_now, nil, nil, { "test_now" => "value_now" }
0
+    assert_equal '>value_now<', flash['test_now']
0
+  end
0
+
0
   def test_process_with_session
0
     process :set_session
0
     assert_equal 'A wonder', session['string'], "A value stored in the session should be available by string key"

Comments