<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>spiral_code &#187; rails rspec</title>
	<atom:link href="http://blog.trydionel.com/tag/rails-rspec/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.trydionel.com</link>
	<description></description>
	<lastBuildDate>Fri, 27 Aug 2010 00:35:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>RSpec Rails Flash Matcher</title>
		<link>http://blog.trydionel.com/2009/11/26/rspec-rails-flash-matcher/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=rspec-rails-flash-matcher</link>
		<comments>http://blog.trydionel.com/2009/11/26/rspec-rails-flash-matcher/#comments</comments>
		<pubDate>Thu, 26 Nov 2009 03:37:46 +0000</pubDate>
		<dc:creator>Jeff Tucker</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[rails rspec]]></category>

		<guid isPermaLink="false">http://trydionel.wordpress.com/?p=49</guid>
		<description><![CDATA[I just started using <a href="http://github.com/thoughtbot/shoulda/">Shoulda's very nice RSpec custom matchers</a>.  They do a great job of trimming the fat off your specs.  One thing I found missing though was a simple matcher to handle the Rails flash.  A quick googling didn't turn up any simple matchers for this, so I put one together and pushed it to github -- <a href="http://github.com/trydionel/rspec-flash-matcher">rspec-flash-matcher</a>. <a href="http://blog.trydionel.com/2009/11/26/rspec-rails-flash-matcher/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE (08 Jan 2010):</strong> Okay, I have no clue how I missed it, but Shoulda already has a flash matcher.  You can find more details in <a href="http://github.com/thoughtbot/shoulda/blob/master/lib/shoulda/action_controller/matchers/set_the_flash_matcher.rb">their GitHub repo</a>.</p>
<p>I just started using <a href="http://github.com/thoughtbot/shoulda/">Shoulda&#8217;s very nice RSpec custom matchers</a>.  They do a great job of trimming the fat off your specs.  One thing I found missing though was a simple matcher to handle the Rails flash.  A quick googling didn&#8217;t turn up any simple matchers for this, so I put one together and pushed it to github &#8212; <a href="http://github.com/trydionel/rspec-flash-matcher">rspec-flash-matcher</a>.</p>
<p>It&#8217;s a pretty straightforward matcher, and lets you reduce</p>
<pre class="brush: ruby;">
it &quot;should set the error flash&quot; do
  flash[:error].should_not be_nil
end
</pre>
<p>to</p>
<pre class="brush: ruby;">
it { should set_flash(:error) }
</pre>
<p>If you like to test actual flash output, you can use</p>
<pre class="brush: ruby;">
it { should set_flash(:error).to(&quot;OMG u broked it&quot;) }
</pre>
<p>I plan to add regex support soon.  Also, I have a suspicion that this won&#8217;t work under Ruby 1.9 because of changes in how <code>send</code> handles protected methods.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.trydionel.com/2009/11/26/rspec-rails-flash-matcher/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
