
<?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>Bryce McDonnell &#124;&#124; Freelance Web Application Developer &#187; TDD</title>
	<atom:link href="http://www.brycemcdonnell.com/skills-and-expert-groups/tdd/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.brycemcdonnell.com</link>
	<description>bryce mcdonnell is a freelance web application developer specializing in PHP, Ruby on Rails and MySQL</description>
	<lastBuildDate>Fri, 26 Feb 2010 18:18:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Custom Routes with Shoulda</title>
		<link>http://www.brycemcdonnell.com/2010/02/custom-routes-with-shoulda/</link>
		<comments>http://www.brycemcdonnell.com/2010/02/custom-routes-with-shoulda/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 20:07:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Stuff I'm Working On]]></category>
		<category><![CDATA[Rspec]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[shoulda]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://www.brycemcdonnell.com/?p=234</guid>
		<description><![CDATA[I&#8217;ve recently been using Shoulda as my testing framework of choice to speed up my Rspec test writing. One common pattern kept recurring which was totally vexing: I wasn&#8217;t able to test my custom routes. Just recently, I was writing a reviews controller that is mostly controlled by an admin user of the site. It&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently been using <a title="thoughtbot's shoulda framwork" href="http://thoughtbot.com/community/" target="_blank">Shoulda</a> as my testing framework of choice to speed up my <a title="Rspec, a great ruby on rails testing framework" href="http://rspec.info/" target="_blank">Rspec</a> test writing. One common pattern kept recurring which was totally vexing: I wasn&#8217;t able to test my custom routes. Just recently, I was writing a reviews controller that is mostly controlled by an admin user of the site. It&#8217;s logical to route the index request of the reviews controller to /admin.</p>
<p>I kept trying to force the request with the following failing code:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;">#don't use this, it's bad</span>
<span style="color:#008000; font-style:italic;"># I want to reroute /reviews to /admin</span>
get <span style="color:#996600;">&quot;/admin&quot;</span></pre></div></div>

<p>That was clearly wrong, but nothing immediately jumped out at me as to how to fix it. After much googling around, I finally found the quick and easy solution:<br />
<a title="ruby code as a gist" href="http://gist.github.com/309123" target="_blank">ruby code on github here</a></p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">describe <span style="color:#996600;">&quot;/admin&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    before<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:each</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span>
      get <span style="color:#ff3333; font-weight:bold;">:index</span>
    <span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
    it <span style="color:#006600; font-weight:bold;">&#123;</span> should route<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:get</span>, <span style="color:#996600;">&quot;/admin&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">to</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:controller</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#ff3333; font-weight:bold;">:reviews</span>, <span style="color:#ff3333; font-weight:bold;">:action</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#ff3333; font-weight:bold;">:index</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
    it <span style="color:#006600; font-weight:bold;">&#123;</span> should respond_with<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:success</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Hope this saves someone else some time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brycemcdonnell.com/2010/02/custom-routes-with-shoulda/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Precision Text</title>
		<link>http://www.brycemcdonnell.com/2009/07/ruby-on-rails-precision-text/</link>
		<comments>http://www.brycemcdonnell.com/2009/07/ruby-on-rails-precision-text/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 15:20:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[portfolio]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[e-commerce]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[sms]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[text messaging]]></category>
		<category><![CDATA[web service consumption]]></category>

		<guid isPermaLink="false">http://blog.thedevranch.net/?p=157</guid>
		<description><![CDATA[<a href=http://www.brycemcdonnell.com/2009/07/ruby-on-rails-precision-text/><img src=http://blog.thedevranch.net/wp-content/uploads/2009/07/precisiontext.png class=imgtfe hspace=5 align=left width=100  border=0></a>Precision Text, a brand new company with only an idea, needed to hire a solid web developer to bring their new business idea to life.  After a few conversations, we both agreed that the best way to bring this idea to the marketplace would be to use the Ruby on Rails framework and a solid text messaging API.

The application allows for business owners to gather a list of their customer's cell phone numbers. The business can then send out a message to these customers alerting them of new deals or special offers. The response rate has been high and the utility to the business has been huge.]]></description>
			<content:encoded><![CDATA[<p><strong>For Precision Text &#8211; Lead Developer/Architect &#8211; 2009</strong></p>
<p><a href="http://www.precisiontext.com" target="_blank">www.precisiontext.com</a></p>
<p><img class="aligncenter size-full wp-image-158" title="precisiontext" src="http://blog.thedevranch.net/wp-content/uploads/2009/07/precisiontext.png" alt="precisiontext" width="402" height="128" /></p>
<p>Precision Text, a brand new company with only an idea, needed to hire a solid web developer to bring their new business idea to life.  After a few conversations, we both agreed that the best way to bring this idea to the marketplace would be to use the Ruby on Rails framework and a solid text messaging API.</p>
<p>The application allows for business owners to gather a list of their customer&#8217;s cell phone numbers. The business can then send out a message to these customers alerting them of new deals or special offers. The response rate has been high and the utility to the business has been huge.</p>
<p>I built the application from scratch and within a month was comfortable with a deployment in a beta stage. Using this beta deployment, the founders put the application through some of their own testing and determined they were comfortable selling the product as it was. Within a month of deployment, they had already secured 10 contracts!</p>
<h2>TDD</h2>
<p>This was the first app that I built in a completely test driven development (TDD) coding style. I have had some experience with unit and functional testing, but I have never actually built an application from scratch using TDD. Even though the processes was new, I still found the coding process to be much more efficient. I will be building apps using only TDD from now on.</p>
<h2>Daemonized Processes / Time Zones</h2>
<p>Sometimes businesses need to send messages later than when they&#8217;re at the computer. Rather than set up a complicated cron job or some other solution, I created a daemon within the application that actively listens for queued messages and sends them according to the time the end user requested.</p>
<p>Implicit in the scheduling is getting their time zone right. From a usability perspective, it is much easier not to do time math when queueing a job. A restaurant owner in Colorado shouldn&#8217;t have to compute the difference of her time zone to where the server is located. Neither would she want a message to accidently go out an hour early.</p>
<p>For usability and business rapport reasons, I implemented automatic adjustments for the time zone the user is in. To the user, it is seamless and easy to manage.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brycemcdonnell.com/2009/07/ruby-on-rails-precision-text/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
