<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.1" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Testing flash.now in Rails</title>
	<link>http://www.pluitsolutions.com/2008/01/22/testing-flashnow-in-rails/</link>
	<description>Web Development and Design, and Anything That Matters</description>
	<pubDate>Wed, 10 Mar 2010 11:49:10 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.1</generator>

	<item>
		<title>by: ATle</title>
		<link>http://www.pluitsolutions.com/2008/01/22/testing-flashnow-in-rails/#comment-184048</link>
		<pubDate>Fri, 22 Jan 2010 08:46:48 +0000</pubDate>
		<guid>http://www.pluitsolutions.com/2008/01/22/testing-flashnow-in-rails/#comment-184048</guid>
					<description>Herryanto, thanks very much. Your third way is very helpful to me!</description>
		<content:encoded><![CDATA[<p>Herryanto, thanks very much. Your third way is very helpful to me!
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Living on the edge (of Rails) #20 - script/dbconsole and flash.now now test-able &#124; redemption in a blog</title>
		<link>http://www.pluitsolutions.com/2008/01/22/testing-flashnow-in-rails/#comment-77142</link>
		<pubDate>Sun, 18 May 2008 12:06:37 +0000</pubDate>
		<guid>http://www.pluitsolutions.com/2008/01/22/testing-flashnow-in-rails/#comment-77142</guid>
					<description>[...] This is something that many of us Rails developers have probably come across when writing tests for flash messages being set with flash.now, myself included. Basically, you couldn&amp;#8217;t test the contents of your flash.now because they were always being emptied before your test could get to them. [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] This is something that many of us Rails developers have probably come across when writing tests for flash messages being set with flash.now, myself included. Basically, you couldn&#8217;t test the contents of your flash.now because they were always being emptied before your test could get to them. [&#8230;]
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Xavier Shay</title>
		<link>http://www.pluitsolutions.com/2008/01/22/testing-flashnow-in-rails/#comment-72150</link>
		<pubDate>Sat, 19 Apr 2008 00:34:59 +0000</pubDate>
		<guid>http://www.pluitsolutions.com/2008/01/22/testing-flashnow-in-rails/#comment-72150</guid>
					<description>Here's another way which is a bit cleaner and more succinct:

http://rhnh.net/2008/04/19/testing-flash-now-with-rspec</description>
		<content:encoded><![CDATA[<p>Here&#8217;s another way which is a bit cleaner and more succinct:</p>
<p><a href='http://rhnh.net/2008/04/19/testing-flash-now-with-rspec' rel='nofollow'>http://rhnh.net/2008/04/19/testing-flash-now-with-rspec</a>
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: ishrat</title>
		<link>http://www.pluitsolutions.com/2008/01/22/testing-flashnow-in-rails/#comment-70034</link>
		<pubDate>Wed, 09 Apr 2008 10:54:49 +0000</pubDate>
		<guid>http://www.pluitsolutions.com/2008/01/22/testing-flashnow-in-rails/#comment-70034</guid>
					<description>I slightly changed the code and it worked for me. My change is as follows:

module ActionController
  module Flash 
    class FlashNow
      def initialize
        @flash = {}
        @now_cache = {}
        @flash[@now_cache] = {}
      end
      
      def []=(k, v)
        @now_cache = k
        @flash[@now_cache]= v
        v
      end
    end
    
    class FlashHash
      def now_cache
        self &amp;#124;&amp;#124; {}
      end
    end
  end 
end</description>
		<content:encoded><![CDATA[<p>I slightly changed the code and it worked for me. My change is as follows:</p>
<p>module ActionController<br />
  module Flash<br />
    class FlashNow<br />
      def initialize<br />
        @flash = {}<br />
        @now_cache = {}<br />
        @flash[@now_cache] = {}<br />
      end</p>
<p>      def []=(k, v)<br />
        @now_cache = k<br />
        @flash[@now_cache]= v<br />
        v<br />
      end<br />
    end</p>
<p>    class FlashHash<br />
      def now_cache<br />
        self || {}<br />
      end<br />
    end<br />
  end<br />
end
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Ishrat</title>
		<link>http://www.pluitsolutions.com/2008/01/22/testing-flashnow-in-rails/#comment-69146</link>
		<pubDate>Thu, 03 Apr 2008 14:45:27 +0000</pubDate>
		<guid>http://www.pluitsolutions.com/2008/01/22/testing-flashnow-in-rails/#comment-69146</guid>
					<description>I put the code in my spec helper file and did exactly as instructed. But when I am running spec it is failing as it is getting nil object. 
Can you help me please??</description>
		<content:encoded><![CDATA[<p>I put the code in my spec helper file and did exactly as instructed. But when I am running spec it is failing as it is getting nil object.<br />
Can you help me please??
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: &#187; Use flash.now to render current view Advanced Rails: Rails Books and Blogs</title>
		<link>http://www.pluitsolutions.com/2008/01/22/testing-flashnow-in-rails/#comment-68469</link>
		<pubDate>Fri, 28 Mar 2008 03:30:53 +0000</pubDate>
		<guid>http://www.pluitsolutions.com/2008/01/22/testing-flashnow-in-rails/#comment-68469</guid>
					<description>[...] This blog tell the details,and this page tells how to test flash.now and more in the this bolg . [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] This blog tell the details,and this page tells how to test flash.now and more in the this bolg . [&#8230;]
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Vinícius Teles</title>
		<link>http://www.pluitsolutions.com/2008/01/22/testing-flashnow-in-rails/#comment-68464</link>
		<pubDate>Fri, 28 Mar 2008 02:25:04 +0000</pubDate>
		<guid>http://www.pluitsolutions.com/2008/01/22/testing-flashnow-in-rails/#comment-68464</guid>
					<description>Herryanto, thanks a lot. This was very useful to me!</description>
		<content:encoded><![CDATA[<p>Herryanto, thanks a lot. This was very useful to me!
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Herryanto Siatono</title>
		<link>http://www.pluitsolutions.com/2008/01/22/testing-flashnow-in-rails/#comment-65867</link>
		<pubDate>Fri, 14 Mar 2008 01:50:31 +0000</pubDate>
		<guid>http://www.pluitsolutions.com/2008/01/22/testing-flashnow-in-rails/#comment-65867</guid>
					<description>Federico, you shouldn't be calling &quot;flash.flashed[:key_name]&quot; if you are using my method, you should only call &quot;flashed&quot; when you are using flashback plugin by Justin.

With my patch in your test_helper.rb or spec_helper.rb you should just call flash.now_cache[:key_name].</description>
		<content:encoded><![CDATA[<p>Federico, you shouldn&#8217;t be calling &#8220;flash.flashed[:key_name]&#8221; if you are using my method, you should only call &#8220;flashed&#8221; when you are using flashback plugin by Justin.</p>
<p>With my patch in your test_helper.rb or spec_helper.rb you should just call flash.now_cache[:key_name].
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Federico</title>
		<link>http://www.pluitsolutions.com/2008/01/22/testing-flashnow-in-rails/#comment-65800</link>
		<pubDate>Thu, 13 Mar 2008 17:46:13 +0000</pubDate>
		<guid>http://www.pluitsolutions.com/2008/01/22/testing-flashnow-in-rails/#comment-65800</guid>
					<description>Iam trying to use the flashed method but I get the error &quot;NoMethodError: undefined method `flashed' for {}:ActionController::Flash::FlashHash&quot;

What am i doing wrong?</description>
		<content:encoded><![CDATA[<p>Iam trying to use the flashed method but I get the error &#8220;NoMethodError: undefined method `flashed&#8217; for {}:ActionController::Flash::FlashHash&#8221;</p>
<p>What am i doing wrong?
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Dan Z</title>
		<link>http://www.pluitsolutions.com/2008/01/22/testing-flashnow-in-rails/#comment-62240</link>
		<pubDate>Mon, 25 Feb 2008 18:20:18 +0000</pubDate>
		<guid>http://www.pluitsolutions.com/2008/01/22/testing-flashnow-in-rails/#comment-62240</guid>
					<description>Excellent! This is exactly what I was looking for. Thanks!</description>
		<content:encoded><![CDATA[<p>Excellent! This is exactly what I was looking for. Thanks!
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
