<?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>Untıttled &#187; Rails</title>
	<atom:link href="http://feedmechocolate.com/untittled/category/rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://feedmechocolate.com/untittled</link>
	<description></description>
	<lastBuildDate>Fri, 27 Aug 2010 19:06:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Stricter routes speccing in RSpec 1.2.0</title>
		<link>http://feedmechocolate.com/untittled/2009/03/16/stricter-routes-speccing-in-rspec-120/</link>
		<comments>http://feedmechocolate.com/untittled/2009/03/16/stricter-routes-speccing-in-rspec-120/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 12:26:02 +0000</pubDate>
		<dc:creator>chrismear</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[routes]]></category>
		<category><![CDATA[routing]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[specs]]></category>

		<guid isPermaLink="false">http://feedmechocolate.com/untittled/?p=10</guid>
		<description><![CDATA[I just updated the Greenvoice codebase to use Rails 2.3.2 and RSpec 1.2.0, and got a flurry of failing examples from our routing specs. It turns out the routes_for helper in RSpec 1.2.0 is a bit stricter when it comes to request methods and parameters. For example, here&#8217;s an example that worked pre-1.2.0: route_for(:controller =&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>I just updated the <a href="http://greenvoice.com/">Greenvoice</a> codebase to use <a href="http://github.com/rails/rails/commit/73fc42cc0b5e94541480032c2941a50edd4080c2">Rails 2.3.2</a> and <a href="http://github.com/dchelimsky/rspec-rails/tree/1.2.0">RSpec 1.2.0</a>, and got a flurry of failing examples from our routing specs. It turns out the routes_for helper in RSpec 1.2.0 is a bit stricter when it comes to request methods and parameters.</p>
<p>For example, here&#8217;s an example that worked pre-1.2.0:</p>
<pre class="brush: ruby">
route_for(:controller =&gt; &#039;friends&#039;,
          :action =&gt; &#039;request_friend&#039;,
          :user_id =&gt; 1).should ==
&#039;/users/1/friends/request_friend&#039;
</pre>
<p>This fails under 1.2.0, for two reasons. First, if your route doesn&#8217;t accept GET requests, you need to specify the method like this:</p>
<pre class="brush: ruby">
route_for(:controller =&gt; &#039;friends&#039;,
          :action =&gt; &#039;request_friend&#039;,
          :user_id =&gt; 1).should ==
{
  :path =&gt; &#039;/users/1/friends/request_friend&#039;,
  :method =&gt; :delete
}
</pre>
<p>Second, it&#8217;s stricter about all parameters being strings; in this example, the user_id parameter was specified as a number, and it wasn&#8217;t matching. This is the final, passing example:</p>
<pre class="brush: ruby">
route_for(:controller =&gt; &#039;friends&#039;,
          :action =&gt; &#039;request_friend&#039;,
          :user_id =&gt; &#039;1&#039;).should ==
{
  :path =&gt; &#039;/users/1/friends/request_friend&#039;,
  :method =&gt; :delete
}
</pre>
<p><strong>Update:</strong> Of course, if I&#8217;d bothered to look, this is all pointed out in the <a href="http://github.com/dchelimsky/rspec-rails/blob/1a02d5331f04f2f1af86ff8321140929c1f4e1d9/Upgrade.markdown">&#8216;Upgrade&#8217; document that comes with RSpec 1.2.0</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://feedmechocolate.com/untittled/2009/03/16/stricter-routes-speccing-in-rspec-120/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

