<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>acts_as_developer: Write at least a simple functional test for each of your actions</title>
    <link>http://www.robertshowalter.com/articles/2007/06/23/write-at-least-simple-functional-tests-for-each-of-your-actions</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Write at least a simple functional test for each of your actions</title>
      <description>&lt;p&gt;If you&amp;#8217;re like me, you focus on writing unit tests more than functional tests. Most of the key business logic should be in your models anyway, and it&amp;#8217;s easier to test at that level.&lt;/p&gt;


	&lt;p&gt;Nevertheless, it&amp;#8217;s a good idea to at least write a basic functional test for each action to make sure the action at least runs through without any exceptions.&lt;/p&gt;


	&lt;p&gt;If you run &lt;a href="http://www.zenspider.com/ZSS/Products/ZenTest/"&gt;autotest&lt;/a&gt; (which is a great tool), or at least run rake:test before any commits, these simple tests can catch boneheaded mistakes like one I made today.&lt;/p&gt;


	&lt;p&gt;I modified a controller and added an instance varible, which I then referenced in a partial. Everything worked fine and it looked good in the browser, so I committed it.&lt;/p&gt;


	&lt;p&gt;Unfortunately, I stupidly forgot that the partial was used in another context, and that action promptly broke, because I didn&amp;#8217;t create the instance variable there. As it turns out, the proper fix was to move my instance variable out of the partial and into the main template.&lt;/p&gt;


	&lt;p&gt;A simple functional test on each action would have revealed my mistake right away.&lt;/p&gt;</description>
      <pubDate>Sat, 23 Jun 2007 14:03:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:60e50e8f-0379-4187-b8fd-47dd24e4ec16</guid>
      <author>Bob Showalter</author>
      <link>http://www.robertshowalter.com/articles/2007/06/23/write-at-least-simple-functional-tests-for-each-of-your-actions</link>
      <category>Rails</category>
    </item>
  </channel>
</rss>
