<?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>Sam Pierson&#039;s Blog &#187; rspec</title>
	<atom:link href="http://sampierson.com/blog/tag/rspec/feed/" rel="self" type="application/rss+xml" />
	<link>http://sampierson.com/blog</link>
	<description>Augmentation of an Imperfect Memory.</description>
	<lastBuildDate>Wed, 21 Jul 2010 01:41:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Easy rspec matchers</title>
		<link>http://sampierson.com/blog/software-development/easy-rspec-matchers/</link>
		<comments>http://sampierson.com/blog/software-development/easy-rspec-matchers/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 00:04:09 +0000</pubDate>
		<dc:creator>sam</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sampierson.com/blog/?p=646</guid>
		<description><![CDATA[http://rspec.rubyforge.org/rspec/1.2.9/classes/Spec/Matchers.html
]]></description>
			<content:encoded><![CDATA[<p><a href="http://rspec.rubyforge.org/rspec/1.2.9/classes/Spec/Matchers.html">http://rspec.rubyforge.org/rspec/1.2.9/classes/Spec/Matchers.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sampierson.com/blog/software-development/easy-rspec-matchers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RSpec view tests and url_for</title>
		<link>http://sampierson.com/blog/software-development/rspec-view-tests-and-url_for/</link>
		<comments>http://sampierson.com/blog/software-development/rspec-view-tests-and-url_for/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 04:46:42 +0000</pubDate>
		<dc:creator>sam</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rspec]]></category>

		<guid isPermaLink="false">http://sampierson.com/blog/?p=275</guid>
		<description><![CDATA[Ran into a problem with RSpec when trying to create a spec for a view that used an ActionView url helper that required additional parameters to generate the url.


route.edit_page ':site/edit', :conditions =&#62; &#123; :method =&#62; :get &#125;, :controller =&#62; 'webpages', :action =&#62; 'edit_page'

The above route sets params[:site] which is later used for url generation (using, [...]]]></description>
			<content:encoded><![CDATA[<p>Ran into a problem with RSpec when trying to create a spec for a view that used an ActionView url helper that required additional parameters to generate the url.<br />
<br/></p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">route.<span style="color:#9900CC;">edit_page</span> <span style="color:#996600;">':site/edit'</span>, <span style="color:#ff3333; font-weight:bold;">:conditions</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:method</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:get</span> <span style="color:#006600; font-weight:bold;">&#125;</span>, <span style="color:#ff3333; font-weight:bold;">:controller</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'webpages'</span>, <span style="color:#ff3333; font-weight:bold;">:action</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'edit_page'</span></pre></div></div>

<div>The above route sets params[:site] which is later used for url generation (using, <em>edit_page_path</em>). Investigation revealed however that url_for is not actually using params[] to get default values for urls, but actually @request.path_parameters:</div>
<p><br/></p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#6666ff; font-weight:bold;">ActionView::Helpers::UrlHelper</span>.<span style="color:#9900CC;">url_for</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#6666ff; font-weight:bold;">ActionController::Base</span>.<span style="color:#9900CC;">url_for</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#6666ff; font-weight:bold;">ActionController::UrlRewriter</span>.<span style="color:#9900CC;">rewrite</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
       <span style="color:#6666ff; font-weight:bold;">ActionController::UrlRewriter</span>.<span style="color:#9900CC;">rewrite_url</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
         <span style="color:#6666ff; font-weight:bold;">ActionController::UrlRewriter</span>.<span style="color:#9900CC;">rewrite_path</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
           <span style="color:#6666ff; font-weight:bold;">Routing::Routes</span>.<span style="color:#9900CC;">generate</span><span style="color:#006600; font-weight:bold;">&#40;</span>options, <span style="color:#0066ff; font-weight:bold;">@request</span>.<span style="color:#9900CC;">symbolized_path_parameters</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<div>ViewExampleGroup#render doesn&#8217;t provide the facility to add anything to @request.path_parameters, like get/put and friends do in ControllerExampleGroup.</div>
<div>DChelimsky said file a feature request on lighthouse for it, but before I do that I want to do some further investigation and see whether this is needed for nested resources as well, which would make it a more compelling feature, and probably take a stab at patching it myself. </div>
]]></content:encoded>
			<wfw:commentRss>http://sampierson.com/blog/software-development/rspec-view-tests-and-url_for/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
