<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Clayton Lengel-Zigich</title>
	
	<link>http://www.claytonlz.com</link>
	<description>Ruby on Rails Developer</description>
	<pubDate>Sat, 06 Jun 2009 04:02:39 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.8-bleeding-edge</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/claytonlengelzigich" type="application/rss+xml" /><item>
		<title>Using Ruby’s true in Cucumber Multiline Tables</title>
		<link>http://feedproxy.google.com/~r/claytonlengelzigich/~3/cVP4Cb4K0BE/</link>
		<comments>http://www.claytonlz.com/index.php/2009/06/using-rubys-true-in-cucumber-multiline-tables/#comments</comments>
		<pubDate>Sat, 06 Jun 2009 04:02:39 +0000</pubDate>
		<dc:creator>Clayton</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.claytonlz.com/?p=266</guid>
		<description><![CDATA[Last week my pair and I ran into a problem with a failing Cucumber scenario. We were using one of the more awesome features of Cucumber, multiline tables, when we got the unexpected failure. We realized that what we were doing was probably a common pattern and would certain trip other's up.]]></description>
			<content:encoded><![CDATA[<p>Last week my pair and I ran into a problem with a failing Cucumber scenario. We were using one of the more awesome features of Cucumber, multiline tables, when we got the unexpected failure. We realized that what we were doing was probably a common pattern and would certain trip other&#8217;s up.</p>

<h3>Scenario and Step</h3>

<p>If you&#8217;re not familiar with multiline tables in cucumber, take a look at the <a href="http://wiki.github.com/aslakhellesoy/cucumber/multiline-step-arguments">wiki entry</a>.  We were specifying a list of attributes on one of our models that we wanted to have access to in our step. First, here is an example scenario outline.</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">Scenario: Finding a specific dog
  Given an existing microchipped dog named <span style="color:#996600;">&quot;George&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">When</span> I search <span style="color:#9966CC; font-weight:bold;">for</span> a dog with the following attributes:
    <span style="color:#006600; font-weight:bold;">|</span> name   <span style="color:#006600; font-weight:bold;">|</span> microchipped <span style="color:#006600; font-weight:bold;">|</span>
    <span style="color:#006600; font-weight:bold;">|</span> George <span style="color:#006600; font-weight:bold;">|</span> <span style="color:#0000FF; font-weight:bold;">true</span>         <span style="color:#006600; font-weight:bold;">|</span>
  <span style="color:#9966CC; font-weight:bold;">Then</span> I find <span style="color:#996600;">&quot;1&quot;</span> dog
  <span style="color:#9966CC; font-weight:bold;">And</span> that dog should be named <span style="color:#996600;">&quot;George&quot;</span></pre></td></tr></table></div>




<p>Our step was taking the multiline table attributes and using them in an ActiveRecord find, like this.</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">/</span>^I search <span style="color:#9966CC; font-weight:bold;">for</span> a dog with the following attributes:$<span style="color:#006600; font-weight:bold;">/</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>table<span style="color:#006600; font-weight:bold;">|</span>
  table.<span style="color:#9900CC;">hashes</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>attributes<span style="color:#006600; font-weight:bold;">|</span>
    <span style="color:#0066ff; font-weight:bold;">@dog</span> = Dog.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:first</span>, <span style="color:#ff3333; font-weight:bold;">:conditions</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> attributes<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>




<p>In our example we are looking for two attributes a string called &#8220;name&#8221; and a boolean called &#8220;microchipped&#8221;. However, this find will always fail, even if your &#8216;Given an existing microchipped dog named &#8220;George&#8221;&#8216; step explicitly sets up the correct object in the beginning of the test.</p>

<h3>The Fix</h3>

<p>We found that if we changed our scenario to look like this, everything worked fine.</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">Scenario: Finding a specific dog
  Given an existing microchipped dog named <span style="color:#996600;">&quot;George&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">When</span> I search <span style="color:#9966CC; font-weight:bold;">for</span> a dog with the following attributes:
    <span style="color:#006600; font-weight:bold;">|</span> name   <span style="color:#006600; font-weight:bold;">|</span> microchipped <span style="color:#006600; font-weight:bold;">|</span>
    <span style="color:#006600; font-weight:bold;">|</span> George <span style="color:#006600; font-weight:bold;">|</span> 1            <span style="color:#006600; font-weight:bold;">|</span>
  <span style="color:#9966CC; font-weight:bold;">Then</span> I find <span style="color:#996600;">&quot;1&quot;</span> dog
  <span style="color:#9966CC; font-weight:bold;">And</span> that dog should be named <span style="color:#996600;">&quot;George&quot;</span></pre></td></tr></table></div>




<p>See the change? We changed &#8220;true&#8221; for microchipped to &#8220;1&#8243;. Typically when you&#8217;re working with rails you can pass <tt>true</tt> in the conditions of an ActiveRecord find and Rails will convert that to the correct <span class="caps">SQL </span>string for you. However, because cucumber passes each argument in the multiline table rows as strings, Rails never has the chance to covert that <tt>true</tt> for you.</p>

<p>In the first, failing, example you end up with something like this for your <span class="caps">SQL</span>:</p>


<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span> <span style="color: #993333; font-weight: bold;">FROM</span> dogs <span style="color: #993333; font-weight: bold;">WHERE</span> name <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">&quot;George&quot;</span> <span style="color: #993333; font-weight: bold;">AND</span> microchipped <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #993333; font-weight: bold;">LIMIT</span> <span style="color: #cc66cc;">1</span>;</pre></div></div>




<p>In the second, passing, example you end up with something like this:</p>


<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span> <span style="color: #993333; font-weight: bold;">FROM</span> dogs <span style="color: #993333; font-weight: bold;">WHERE</span> name <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">&quot;George&quot;</span> <span style="color: #993333; font-weight: bold;">AND</span> microchipped <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #993333; font-weight: bold;">LIMIT</span> <span style="color: #cc66cc;">1</span>;</pre></div></div>
<img src="http://feeds.feedburner.com/~r/claytonlengelzigich/~4/cVP4Cb4K0BE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.claytonlz.com/index.php/2009/06/using-rubys-true-in-cucumber-multiline-tables/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.claytonlz.com/index.php/2009/06/using-rubys-true-in-cucumber-multiline-tables/</feedburner:origLink></item>
		<item>
		<title>Test Driven Development Talk with ASUSoDA</title>
		<link>http://feedproxy.google.com/~r/claytonlengelzigich/~3/jwVIa3LEeiQ/</link>
		<comments>http://www.claytonlz.com/index.php/2009/04/test-driven-development-talk-with-asusoda/#comments</comments>
		<pubDate>Tue, 28 Apr 2009 05:14:31 +0000</pubDate>
		<dc:creator>Clayton</dc:creator>
				<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[Social Networking]]></category>

		<guid isPermaLink="false">http://www.claytonlz.com/?p=255</guid>
		<description><![CDATA[Tonight I had the privilege of giving a presentation on Test Driven Development to the "ASUSoDA":http://asusoda.com group at ASU.  I focused on a higher level aspect of testing and the benefits and pitfalls of TDD. After my planned presentation I was also able to demo my "Intern Management App":http://github.com/clayton/cucumber-demo/tree/master which was fun given the lighthearted nature of the examples.]]></description>
			<content:encoded><![CDATA[<p>Tonight I had the privilege of giving a presentation on Test Driven Development to the <a href="http://asusoda.com"><span class="caps">ASUS</span>oDA</a> group at <span class="caps">ASU. </span> I focused on the higher level aspects of testing and the specific benefits and pitfalls of <span class="caps">TDD.</span> After my planned presentation I was also able to demo my <a href="http://github.com/clayton/cucumber-demo/tree/master">Intern Management App</a> which was fun given the lighthearted nature of the examples.</p>

<p>Here are the slides from my presentation: <a href="http://www.claytonlz.com/wp-content/uploads/2009/04/asusoda_tdd_20090427.pdf">852k <span class="caps">PDF</span></a></p><img src="http://feeds.feedburner.com/~r/claytonlengelzigich/~4/jwVIa3LEeiQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.claytonlz.com/index.php/2009/04/test-driven-development-talk-with-asusoda/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.claytonlz.com/index.php/2009/04/test-driven-development-talk-with-asusoda/</feedburner:origLink></item>
		<item>
		<title>How To: Setup RSpec, Cucumber, Webrat, RCov and Autotest on Leopard</title>
		<link>http://feedproxy.google.com/~r/claytonlengelzigich/~3/tYHkTUt5L1s/</link>
		<comments>http://www.claytonlz.com/index.php/2009/04/how-to-setup-rspec-cucumber-webrat-rcov-and-autotest-on-leopard/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 20:00:24 +0000</pubDate>
		<dc:creator>Clayton</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[factory girl]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[rcov]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[webrat]]></category>

		<guid isPermaLink="false">http://www.claytonlz.com/?p=220</guid>
		<description><![CDATA[RSpec, Cucumber, Webrat, RCov and Autotest are a powerful combination of tools for testing your Rails app. Unfortunately getting them to all work nicely together can be a bit of challenge. I recently configured a development environment from scratch on OS X 10.5 Leopard and kept track of all of the little details.]]></description>
			<content:encoded><![CDATA[<p>RSpec, Cucumber, Webrat, RCov and Autotest are a powerful combination of tools for testing your Rails app. Unfortunately getting them to all work nicely together can be a bit of challenge. I recently configured a development environment from scratch on OS X 10.5 Leopard and kept track of all of the little details.</p>

<h3>Prerequisites</h3>

<p>I&#8217;m assuming you&#8217;ve got the following installed:</p>


<ul>
<li>ruby</li>
<li>ruby gems 1.3.1</li>
<li><a href="http://developer.apple.com/Tools/">Apple development tools</a></li>
<li>git</li>
<li>rails &gt;= 2.3.2</li>
<li>You&#8217;ve added github to your gem sources (gem sources -a http://gems.github.com)<br />
<br /></li>
</ul>



<h3>RSpec &amp; RSpec-Rails</h3>

<p>First let&#8217;s grab the rspec<sup class="footnote"><a href="#fn1">1</a></sup> and rspec-rails<sup class="footnote"><a href="#fn2">2</a></sup> gems.</p>


<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">sudo gem install rspec</pre></div></div>





<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">sudo gem install rspec-rails</pre></div></div>




<h3>Cucumber</h3>

<p>Next we&#8217;ll install the cucumber<sup class="footnote"><a href="#fn3">3</a></sup> gem</p>


<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">sudo gem install cucumber</pre></div></div>




<h3>Webrat</h3>

<p>Webrat<sup class="footnote"><a href="#fn4">4</a></sup> is used by cucumber to simulate a browser for your integration tests. Webrat will also install nokogiri<sup class="footnote"><a href="#fn5">5</a></sup>.</p>


<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">sudo gem install webrat</pre></div></div>




<h3>RCov</h3>

<p>I thought RCov<sup class="footnote"><a href="#fn6">6</a></sup> would get installed with RSpec, but it wasn&#8217;t for me. You might not need to do this, but just to make sure&#8230;</p>


<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">sudo gem install rcov</pre></div></div>




<h3>Autotest</h3>

<p>Autotest<sup class="footnote"><a href="#fn7">7</a></sup> comes from ZenTest<sup class="footnote"><a href="#fn8">8</a></sup> and allows you to have a kick ass workflow where you are constantly running relevant tests and less-constantly automatically running your entire test suite.</p>


<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">sudo gem install ZenTest</pre></div></div>




<h3>Optionally, Thoughtbot&#8217;s Factory Girl</h3>

<p>Factory girl<sup class="footnote"><a href="#fn9">9</a></sup> is a really helpful fixture replacement (and more) gem to use in conjunction with cucumber, checkout their <a href="http://giantrobots.thoughtbot.com/2008/6/6/waiting-for-a-factory-girl">much better explanation</a></p>


<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">sudo gem install thoughtbot-factory_girl --source http://gems.github.com</pre></div></div>




<h3>Optionally, Carlos Brando&#8217;s Autotest Notification</h3>

<p>While autotest normally runs in a terminal window, it can be setup to hook into applications like <a href="http://growl.info/">growl</a> or <a href="http://www.fullphat.net/index.php">snarl</a>. The Autotest Notification<sup class="footnote"><a href="#fn9">9</a></sup> gem helps make this setup a lot easier. </p>

<p><strong>You will need growl installed and configured for this step</strong> the installation instructions on this gems github page are very easy to follow.</p>


<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">sudo gem install carlosbrando-autotest-notification --source=http://gems.github.com</pre></div></div>




<p>Next you need to turn autotest notifications &#8220;on&#8221;</p>


<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">an-install</pre></div></div>




<h3>A Sample Rails App</h3>

<p>Let&#8217;s create a sample rails app for the rest of this guide.</p>


<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">rails sample-app</pre></div></div>




<p><strong>Configuring Environment Variables</strong></p>

<p>Autotest relies on some environment variables to run all of your features and specs correctly. If autotest &#8220;hangs&#8221; after you try to run it, or it just never seems to be watching your specs or features, this will most likely solve your problem.</p>

<p>Open the test.rb environment definition file in <code>sample-app/config/environments/test.rb</code> and add the following.</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">ENV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'AUTOFEATURE'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#996600;">&quot;true&quot;</span>
ENV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'RSPEC'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#996600;">&quot;true&quot;</span></pre></td></tr></table></div>




<p>These lines will test autotest to run, and look for changes to, your specs (rather than test unit tests) and your cucumber features.</p>

<p><strong>Update</strong></p>

<p>If you don&#8217;t want to add these environment variables to every rails project you&#8217;ve got on your machine, you can also choose to set them as environment variables in your .bash_profile or .bashrc (or whatever shell you&#8217;re using) files.</p>


<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">export AUTOFEATURE=true
export RSPEC=true</pre></div></div>




<p><strong>Unpacking Gems</strong></p>

<p>Next let&#8217;s freeze (unpack) some gems that we&#8217;ll be using in our app. I&#8217;ve run into problems trying to use the system gems with cucumber, rspec and webrat, especially when I have multiple versions of any of them installed. Unpacking them into my rails app solves this problem for me.</p>


<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">mkdir sample-app/vendor/gems
cd sample-app/vendor/gems
sudo gem unpack rails
sudo gem unpack rspec
sudo gem unpack rspec-rails
sudo gem unpack cucumber</pre></div></div>




<p>Because webrat (and nokogiri) are native gems, that is, they are built locally on your machine based on its architecture, we won&#8217;t unpack those.</p>

<p><strong>config.gem support</strong><br />
The current accepted practice, when using rails 2.3, and as suggested by the rspec guy(s) is to use rails&#8217; <code>config.gem</code> functionality.</p>

<p>Open sample-app/config/environments/test.rb and add the following lines:</p>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">config.<span style="color:#9900CC;">gem</span> <span style="color:#996600;">&quot;rspec&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:lib</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">false</span>, <span style="color:#ff3333; font-weight:bold;">:version</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;&gt;= 1.2.0&quot;</span> 
config.<span style="color:#9900CC;">gem</span> <span style="color:#996600;">&quot;rspec-rails&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:lib</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">false</span>, <span style="color:#ff3333; font-weight:bold;">:version</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;&gt;= 1.2.0&quot;</span> 
config.<span style="color:#9900CC;">gem</span> <span style="color:#996600;">&quot;cucumber&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:lib</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">false</span>, <span style="color:#ff3333; font-weight:bold;">:version</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;&gt;= 0.2.3&quot;</span>
config.<span style="color:#9900CC;">gem</span> <span style="color:#996600;">&quot;thoughtbot-factory_girl&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:lib</span>    <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;factory_girl&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:source</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;http://gems.github.com&quot;</span>
config.<span style="color:#9900CC;">gem</span> <span style="color:#996600;">&quot;webrat&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:lib</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">false</span>, <span style="color:#ff3333; font-weight:bold;">:version</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;&gt;= 0.4.3&quot;</span>
config.<span style="color:#9900CC;">gem</span> <span style="color:#996600;">&quot;nokogiri&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:lib</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">false</span>, <span style="color:#ff3333; font-weight:bold;">:version</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;&gt;= 1.2.3&quot;</span></pre></div></div>




<p>Your version numbers may be different, but these are all current at the time of writing.</p>

<p><strong>Boot Strapping RSpec and Cucumber</strong></p>

<p>Before you can get very far with rspec or cucumber you need to run the bootstrapping scripts to give yourself the default files and directories.</p>


<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;"># From inside your rails app sample-app/
script/generate rspec
script/generate cucumber</pre></div></div>




<p><strong>Factories</strong><br />
Depending on where you&#8217;re going to use your factories the most, you might want to save your file in either <code>spec/</code> or <code>features/</code>. I chose the latter. Only complete this step if you plan to use the FactoryGirl gem.</p>


<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">touch sample-app/features/factories.rb</pre></div></div>




<h3>Getting Accurate RCov Data</h3>

<p>By default RCov is setup to only use your specs when calculating code coverage. If you&#8217;re using Cucumber <em>and</em> RSpec, you&#8217;ll obviously want to include both types of tests to calculate your project&#8217;s true code coverage.</p>

<p>I picked up this rcov rake task from my co-worker <a href="http://jay.mcgavren.com/blog/">Jay McGavren</a> it does all of the heavy lifting for you, we&#8217;ll just need to make a couple of changes.</p>

<p>Drop <a href="http://gist.github.com/89659">this file</a> into sample-app/lib/tasks/rcov.rake and use it by calling <code>rake rcov:all</code> from your terminal.</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'cucumber/rake/task'</span> <span style="color:#008000; font-style:italic;">#I have to add this</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'spec/rake/spectask'</span>
&nbsp;
namespace <span style="color:#ff3333; font-weight:bold;">:rcov</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  <span style="color:#6666ff; font-weight:bold;">Cucumber::Rake::Task</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:cucumber</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>t<span style="color:#006600; font-weight:bold;">|</span>    
    t.<span style="color:#9900CC;">rcov</span> = <span style="color:#0000FF; font-weight:bold;">true</span>
    t.<span style="color:#9900CC;">rcov_opts</span> = <span style="color:#006600; font-weight:bold;">%</span>w<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">--</span>rails <span style="color:#006600; font-weight:bold;">--</span>exclude osx\<span style="color:#006600; font-weight:bold;">/</span>objc,gems\<span style="color:#006600; font-weight:bold;">/</span>,spec\<span style="color:#006600; font-weight:bold;">/</span>,features\<span style="color:#006600; font-weight:bold;">/</span> <span style="color:#006600; font-weight:bold;">--</span>aggregate coverage.<span style="color:#9900CC;">data</span><span style="color:#006600; font-weight:bold;">&#125;</span>
    t.<span style="color:#9900CC;">rcov_opts</span> <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#006600; font-weight:bold;">%</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">-</span>o <span style="color:#996600;">&quot;coverage&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#6666ff; font-weight:bold;">Spec::Rake::SpecTask</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:rspec</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>t<span style="color:#006600; font-weight:bold;">|</span>
    t.<span style="color:#9900CC;">spec_opts</span> = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'--options'</span>, <span style="color:#996600;">&quot;<span style="color:#000099;">\&quot;</span>#{RAILS_ROOT}/spec/spec.opts<span style="color:#000099;">\&quot;</span>&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
    t.<span style="color:#9900CC;">spec_files</span> = FileList<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'spec/**/*_spec.rb'</span><span style="color:#006600; font-weight:bold;">&#93;</span>
    t.<span style="color:#9900CC;">rcov</span> = <span style="color:#0000FF; font-weight:bold;">true</span>
    t.<span style="color:#9900CC;">rcov_opts</span> = <span style="color:#CC0066; font-weight:bold;">lambda</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      <span style="color:#CC00FF; font-weight:bold;">IO</span>.<span style="color:#CC0066; font-weight:bold;">readlines</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;#{RAILS_ROOT}/spec/rcov.opts&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">map</span> <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>l<span style="color:#006600; font-weight:bold;">|</span> l.<span style="color:#CC0066; font-weight:bold;">chomp</span>.<span style="color:#CC0066; font-weight:bold;">split</span> <span style="color:#996600;">&quot; &quot;</span><span style="color:#006600; font-weight:bold;">&#125;</span>.<span style="color:#9900CC;">flatten</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  desc <span style="color:#996600;">&quot;Run both specs and features to generate aggregated coverage&quot;</span>
  task <span style="color:#ff3333; font-weight:bold;">:all</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>t<span style="color:#006600; font-weight:bold;">|</span>
    rm <span style="color:#996600;">&quot;coverage.data&quot;</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">exist</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;coverage.data&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#6666ff; font-weight:bold;">Rake::Task</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;rcov:cucumber&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">invoke</span>
    <span style="color:#6666ff; font-weight:bold;">Rake::Task</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;rcov:rspec&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">invoke</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>




<p>The important part here is on line 7, we want rcov to exclude our features directory. We obviously don&#8217;t need or want rcov telling us that our feature files are not &#8220;covered&#8221;. To solve this problem we&#8217;ve simply excluded the features directory from rcov&#8217;s processing.</p>

<p>We also need to slightly modify <code>sample-app/spec/rcov.opts</code> to get the full rspec + cucumber coverage data.</p>

<p>Your rcov.opts should look like this:</p>


<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">--exclude &quot;spec/*,gems/*,features/*&quot; 
--rails
--aggregate &quot;coverage.data&quot;</pre></div></div>




<p>We again want to ignore our cucumber features and we also want to tell rcov to aggregate data in a file called coverage.data. This is used in the above rake task.</p>

<h3>Write Some Specs and Features!</h3>

<p>Act like you know what you&#8217;re doing and write some models, controllers whatever. Add some specs and features too.</p>

<h3>Autotest Workflow</h3>

<p>Open a terminal and make your way to your sample rails app and fire up autotest. You might see something like the following, depending on how many specs and features you&#8217;ve got.</p>


<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">$&gt; autotest
loading autotest/cucumber_rails_rspec
opts 
...
&nbsp;
Finished in 0.06276 seconds
&nbsp;
3 examples, 0 failures
================================================================================
&nbsp;
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby /Library/Ruby/Gems/1.8/gems/cucumber-0.2.3/bin/cucumber --format progress --format rerun --out /var/folders/Aq/Aqp06i3dFnqse+tQgQA+1++++TI/-Tmp-/autotest-cucumber.75956.0 features
.................
&nbsp;
4 scenarios
17 passed steps
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby /Library/Ruby/Gems/1.8/gems/rspec-1.2.2/bin/spec --autospec spec/models/intern_spec.rb -O spec/spec.opts 
...
&nbsp;
Finished in 0.062995 seconds
&nbsp;
3 examples, 0 failures
================================================================================
&nbsp;
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby /Library/Ruby/Gems/1.8/gems/cucumber-0.2.3/bin/cucumber --format progress --format rerun --out /var/folders/Aq/Aqp06i3dFnqse+tQgQA+1++++TI/-Tmp-/autotest-cucumber.75956.1 features
.................
&nbsp;
4 scenarios
17 passed steps</pre></div></div>




<h3>The <span class="caps">REALLY </span>important stuff</h3>


<ol>
<li>make sure you&#8217;ve got &#8220;ENV['AUTOFEATURE'] = true&#8221; in your test.rb otherwise autotest won&#8217;t run your features automatically</li>
<li>make sure you&#8217;ve got &#8220;ENV['RSPEC'] = true&#8221; in your bash profile or else autotest won&#8217;t run your specs automatically</li>
<li>make sure you&#8217;ve got &#8220;&#8211;aggregate = &#8216;coverage.data&#8217;&#8221; in your spec/rcov.opts file if you&#8217;re going to use the above rake task and hope to get combined rcov coverage data between rspec and cucumber</li>
<li>make sure you&#8217;re excluding the features directory from rcov where required or else you&#8217;ll end up with misleading rcov data.</li>
</ol>



<h3>Gem Versions</h3>

<p>Here&#8217;s a list of the current gems and their versions that I used in preparing this guide.</p>


<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">*** LOCAL GEMS ***
&nbsp;
actionmailer (2.3.2, 1.3.6, 1.3.3)
actionpack (2.3.2, 1.13.6, 1.13.3)
actionwebservice (1.2.6, 1.2.3)
activerecord (2.3.2, 1.15.6, 1.15.3)
activeresource (2.3.2)
activesupport (2.3.2, 1.4.4, 1.4.2)
acts_as_ferret (0.4.1)
addressable (2.0.2)
builder (2.1.2)
capistrano (2.0.0)
carlosbrando-autotest-notification (1.9.1)
cgi_multipart_eof_fix (2.5.0, 2.2)
cucumber (0.2.3)
daemons (1.0.9, 1.0.7)
data_objects (0.9.11)
diff-lcs (1.1.2)
dnssd (0.6.0)
extlib (0.9.11)
fastthread (1.0.1, 1.0)
fcgi (0.8.7)
ferret (0.11.4)
gem_plugin (0.2.3, 0.2.2)
highline (1.2.9)
hpricot (0.6)
libxml-ruby (0.3.8.4)
mongrel (1.1.4, 1.0.1)
mysql (2.7)
needle (1.3.0)
net-sftp (1.1.0)
net-ssh (1.1.2)
nokogiri (1.2.3)
polyglot (0.2.5)
rack (0.9.1)
rails (2.3.2, 1.2.6, 1.2.3)
rake (0.8.4, 0.7.3)
rcov (0.8.1.2.0)
RedCloth (3.0.4)
rspec (1.2.2)
rspec-rails (1.2.2)
ruby-openid (1.1.4)
ruby-yadis (0.3.4)
rubynode (0.1.3)
sources (0.0.1)
sqlite3-ruby (1.2.1)
term-ansicolor (1.0.3)
termios (0.9.4)
textmate (0.9.2)
thor (0.9.9)
thoughtbot-factory_girl (1.2.0)
treetop (1.2.5)
webrat (0.4.3)
ZenTest (4.0.0)</pre></div></div>




<h3>El Fin</h3>

<p>Hopefully this guide was useful or had that one little step that you needed to get everything working. I&#8217;m sure this will all be out of date in the coming weeks, but I&#8217;ll try to keep it as up-to-date as possible. If you see any errors, or can better explain some of the missing pieces, please post a comment. Thanks!</p>

<p class="footnote" id="fn1"><sup>1</sup> <a href="http://github.com/dchelimsky/rspec/tree/master">http://github.com/dchelimsky/rspec/tree/master</a></p>

<p class="footnote" id="fn2"><sup>2</sup> <a href="http://github.com/dchelimsky/rspec-rails/tree/master">http://github.com/dchelimsky/rspec-rails/tree/master</a></p>

<p class="footnote" id="fn3"><sup>3</sup> <a href="http://github.com/aslakhellesoy/cucumber/tree/master">http://github.com/aslakhellesoy/cucumber/tree/master</a></p>

<p class="footnote" id="fn4"><sup>4</sup> <a href="http://wiki.github.com/brynary/webrat">http://wiki.github.com/brynary/webrat</a></p>

<p class="footnote" id="fn5"><sup>5</sup> <a href="http://github.com/tenderlove/nokogiri/tree/master">http://github.com/tenderlove/nokogiri/tree/master</a> </p>

<p class="footnote" id="fn6"><sup>6</sup> <a href="http://rubyforge.org/projects/rcov/">http://rubyforge.org/projects/rcov/</a></p>

<p class="footnote" id="fn7"><sup>7</sup> <a href="http://www.zenspider.com/ZSS/Products/ZenTest/#rsn">http://www.zenspider.com/ZSS/Products/ZenTest/#rsn</a></p>

<p class="footnote" id="fn8"><sup>8</sup> <a href="http://www.zenspider.com/ZSS/Products/ZenTest/">http://www.zenspider.com/ZSS/Products/ZenTest/</a></p>

<p class="footnote" id="fn9"><sup>9</sup> <a href="http://github.com/thoughtbot/factory_girl/tree/master">http://github.com/thoughtbot/factory_girl/tree/master</a></p>

<p class="footnote" id="fn10"><sup>10</sup> <a href="http://github.com/carlosbrando/autotest-notification/tree/master">http://github.com/carlosbrando/autotest-notification/tree/master</a></p><img src="http://feeds.feedburner.com/~r/claytonlengelzigich/~4/tYHkTUt5L1s" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.claytonlz.com/index.php/2009/04/how-to-setup-rspec-cucumber-webrat-rcov-and-autotest-on-leopard/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.claytonlz.com/index.php/2009/04/how-to-setup-rspec-cucumber-webrat-rcov-and-autotest-on-leopard/</feedburner:origLink></item>
		<item>
		<title>The FAIL Monster Loves Excuses</title>
		<link>http://feedproxy.google.com/~r/claytonlengelzigich/~3/1DjkXQ87JNY/</link>
		<comments>http://www.claytonlz.com/index.php/2009/03/the-fail-monster-loves-excuses/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 17:15:58 +0000</pubDate>
		<dc:creator>Clayton</dc:creator>
				<category><![CDATA[Ideas]]></category>
		<category><![CDATA[Riffs]]></category>
		<category><![CDATA[accountability]]></category>
		<category><![CDATA[FAIL]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[people]]></category>

		<guid isPermaLink="false">http://www.claytonlz.com/?p=175</guid>
		<description><![CDATA[Do you remember watching the FAIL Monster on Sesame Street? Never heard of the FAIL Monster? Weird, I'm pretty sure he was "Cookie Monster's":http://www.youtube.com/watch?v=dhUFxaauNTE cousin or something. He would pop-up and sing a little song about your failures and then at the end he would go crazy and NOM NOM NOM all of your excuses. The really strange thing is that when I grew up, I still saw the FAIL Monster, except he was all over, eating up everyone's excuses, not just mine. When was the last time the FAIL Monster paid _you_ a visit?]]></description>
			<content:encoded><![CDATA[<p>Do you remember watching the <span class="caps">FAIL</span> Monster on Sesame Street? Never heard of the <span class="caps">FAIL</span> Monster? Weird, I&#8217;m pretty sure he was <a href="http://www.youtube.com/watch?v=dhUFxaauNTE">Cookie Monster&#8217;s</a> cousin or something. He would pop-up and sing a little song about your failures and then at the end he would go crazy and <span class="caps">NOM NOM NOM </span>all of your excuses. The really strange thing is that when I grew up, I still saw the <span class="caps">FAIL</span> Monster, except he was all over, eating up everyone&#8217;s excuses, not just mine. When was the last time the <span class="caps">FAIL</span> Monster paid <em>you</em> a visit?</p>

<h3>The <span class="caps">FAIL</span> Monster Is Your Worst Best Friend</h3>

<p>When you first meet him you&#8217;re trying to figure out what this asshole is doing hanging out right after you really screwed up. You realize that he&#8217;s no good, but as time goes on, you start enjoying his company. He loves showing up because he knows there will be excuses aplenty.</p>

<p>Here are some situations when you might see him:</p>


<ul>
<li>You&#8217;ve messed up and can&#8217;t take responsibility</li>
<li>The project is off track and it&#8217;s not at <em>all</em> your fault</li>
<li>If only <em>&lt; outside agent &gt;</em> would have completed <em>&lt; task &gt;</em> on time</li>
<li>You start using <a href="http://www.youtube.com/watch?v=5110hk9W71E">Fat Bastard&#8217;s</a> circular logic to explain away your problems</li>
<li>&#8220;I don&#8217;t have <em>&lt; resource &gt;</em> to do <em>&lt; what is right &gt;</em></li>
<li>You <a href="http://smartic.us/2008/8/15/tatft-i-feel-a-revolution-coming-on">don&#8217;t write tests</a><br />
<br /></li>
</ul>



<h3>Put the <span class="caps">FAIL</span> Monster on a Diet</h3>

<p>Here is a quick guide to help you trim down your personal <span class="caps">FAIL</span> Monster:</p>


<ol>
<li>Quit making so many goddamned excuses!<br />
<br /></li>
</ol>



<p>Stop making excuses for your lack of understanding, your irresponsibility, your lack of prospects and your shit attitude. Take the time to push yourself, learn a new skill, read a book, meet people, take a leadership role, achieve greatness and succeed.</p>

<p>You can make excuses for everything, the only thing they&#8217;re good for is feeding your own <span class="caps">FAILURE.</span></p><img src="http://feeds.feedburner.com/~r/claytonlengelzigich/~4/1DjkXQ87JNY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.claytonlz.com/index.php/2009/03/the-fail-monster-loves-excuses/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.claytonlz.com/index.php/2009/03/the-fail-monster-loves-excuses/</feedburner:origLink></item>
		<item>
		<title>Why I Fell in Love With Agile</title>
		<link>http://feedproxy.google.com/~r/claytonlengelzigich/~3/JomJz34-7C0/</link>
		<comments>http://www.claytonlz.com/index.php/2009/03/why-i-fell-in-love-with-agile/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 17:00:13 +0000</pubDate>
		<dc:creator>Clayton</dc:creator>
				<category><![CDATA[Ideas]]></category>
		<category><![CDATA[Riffs]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[rants]]></category>

		<guid isPermaLink="false">http://www.claytonlz.com/?p=139</guid>
		<description><![CDATA[I've been working at "Integrum":http://www.integrumtech.com for nearly 5 months now. When I started agile was a concept that I had read about, but never experienced in practice. I took bits and pieces of advice from books like "Extreme Programming Explained":http://www.amazon.com/Extreme-Programming-Explained-Embrace-Change/dp/0201616416 and "Practices of an Agile Developer":http://www.amazon.com/Practices-Agile-Developer-Pragmatic-Programmers/dp/097451408X/ref=sr_1_1?ie=UTF8&#038;s=books&#038;qid=1237965348&#038;sr=1-1 but I had never really lived day-in day-out as a developer in an agile workplace. However, now that I've experienced the project boards, burn down charts, velocities and story workshops, I cannot imagine going back to the slam-your-head-against-the-wall waterfall approach from which I came.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working at <a href="http://www.integrumtech.com">Integrum</a> for nearly 5 months now. When I started, agile was a concept that I had read about, but never experienced in practice. I took bits and pieces of advice from books like <a href="http://www.amazon.com/Extreme-Programming-Explained-Embrace-Change/dp/0201616416">Extreme Programming Explained</a> and <a href="http://www.amazon.com/Practices-Agile-Developer-Pragmatic-Programmers/dp/097451408X/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1237965348&amp;sr=1-1">Practices of an Agile Developer</a> but I had never really lived day-in day-out as a developer in an agile workplace. However, now that I&#8217;ve experienced the project boards, burn down charts, velocities and story workshops, I cannot imagine going back to the slam-your-head-against-the-wall waterfall approach from which I came.</p>

<h3>What I Love</h3>

<p><strong>Project Boards</strong> - Nearly real-time visual feedback on the status of your project. Everyone on the team can assess your project at a glance and you can avoid long status meetings with middle management. Greatly increases accountability.</p>

<p><strong>Stand-up Meetings</strong> - Quick, informative useful meetings that don&#8217;t waste people&#8217;s time. Social group pressure keeps people who like the sound of their own voice from talking for 30 minutes.</p>

<p><strong>Daily Client Interaction</strong> - No need for ego-maniac project managers. Developers discuss issues with clients each day so that they can deliver the best software with the most value as quickly as possible. Challenges or roadblocks can be brought up almost immediately helping to prevent wasted time on either side of the equation.</p>

<p><strong>User Stories</strong> - &#8220;Replacements for a conversation&#8221; as I always hear around the office. Replaces the need to confusing spec documents and misguided feature requests. These provide a way to ensure that neither the client&#8217;s money or developer&#8217;s time are being wasted.</p>

<p><strong>Acceptance Criteria</strong> - It&#8217;s not easy getting quality acceptance criteria from your clients, but <em>man</em> is it worth it. Helps to make sure that what&#8217;s &#8220;done is done&#8221; and there are no disputes towards the end of the project about what is or is not completed.</p>

<p><strong>Short Iterations</strong> - Allows the developer to focus on a set of the most important tasks for a short period of time. The client receives frequent demonstrations of the completed work and changes in course can be made very quickly. What was important 4 months ago during the original planning session might not be important this week.</p>

<h3>Waterfall Development: DO <span class="caps">NOT WANT</span>!</h3>

<p>Looking back on my last job where waterfall development was the norm, I can&#8217;t imagine how I got anything done. When I really think about it, I wonder how much software I wrote that was &#8220;right&#8221; the first time around. </p>

<p>Just as a quick list, here are some of the things I&#8217;ve grown to hate:</p>


<ul>
<li>Project manager dominated client interaction</li>
<li>Long useless meetings</li>
<li>Finger pointing and blaming and lack of accountability</li>
<li>Waiting a few weeks to find out that your implementation is incorrect</li>
<li>No way to tell what was actually &#8220;done&#8221;</li>
<li>Wasteful spec documents<br />
<br /></li>
</ul>



<h3>This Won&#8217;t Work For <em>My</em> Business</h3>

<p>There are probably a lot of development shops that are humming along using long standing processes based on a waterfall model. A lot of people probably think that they don&#8217;t <em>need</em> to change because &#8220;if it ain&#8217;t broke, don&#8217;t fix it&#8221;. If you&#8217;re not doing agile your shit is broke!</p>

<p>A lot of managers probably think that this system won&#8217;t work with their employees. I can see this being the case if any of the following apply:</p>


<ul>
<li>You don&#8217;t trust your employees</li>
<li>Your employees are morons (or you think they are)</li>
<li>You think you need to operate like the status quo</li>
<li>You can&#8217;t give up your control on the process</li>
<li>Your clients suck<br />
<br /></li>
</ul>



<h3>Agile Works at Integrum</h3>

<p><a href="http://derekneighbors.com">Derek Neighbors</a> has taken the time to produce a couple of videos outlining how agile is put into action at Integrum:</p>


<ul>
<li><a href="http://vimeo.com/3518350">Integrum Agile Workspace</a></li>
<li><a href="http://vimeo.com/3338191">Integrum Project Board</a><br />
<br /></li>
</ul>



<p>Whatever the reason, agile works, like actually <em>works</em>, at <a href="http://www.integrumtech.com">Integrum</a>. Is it the culture? The people? The atmosphere? The expectations? The clients? I can&#8217;t quite put my finger on it, but I can guarantee it&#8217;s not coincidental. </p><img src="http://feeds.feedburner.com/~r/claytonlengelzigich/~4/JomJz34-7C0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.claytonlz.com/index.php/2009/03/why-i-fell-in-love-with-agile/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.claytonlz.com/index.php/2009/03/why-i-fell-in-love-with-agile/</feedburner:origLink></item>
		<item>
		<title>RSpec Shared Example before(:each) Gotcha</title>
		<link>http://feedproxy.google.com/~r/claytonlengelzigich/~3/FzNN_8o22Dk/</link>
		<comments>http://www.claytonlz.com/index.php/2009/03/rspec-shared-example-before-each-gotcha/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 20:04:31 +0000</pubDate>
		<dc:creator>Clayton</dc:creator>
				<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[gotcha]]></category>
		<category><![CDATA[rspec]]></category>

		<guid isPermaLink="false">http://www.claytonlz.com/?p=124</guid>
		<description><![CDATA[Shared example groups are a great feature of Rspec that help you simplify your tests and keep your code DRY. You setup shared example groups almost exactly like you would a regular set of specs, but these similarities can be slightly misleading.]]></description>
			<content:encoded><![CDATA[<p>Shared example groups are a great feature of Rspec that help you simplify your tests and keep your code <span class="caps">DRY.</span> You setup shared example groups almost exactly like you would a regular set of specs, but these similarities can be slightly misleading.</p>

<p>Below we have an example model, spec and <a href="http://rspec.info/documentation/">shared example group</a>. Our Dog model has its own set of functionality, but as a mammal it should still have some aspects of being a mammal. We&#8217;ve got some specs in a shared example group that we use for testing all of our mammal models to make sure things don&#8217;t get too out of whack in the universe.</p>

<h3>Our Example Model</h3>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Dog
&nbsp;
  attr_accessor <span style="color:#ff3333; font-weight:bold;">:name</span>, <span style="color:#ff3333; font-weight:bold;">:mammal</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> initialize
    <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">mammal</span> = <span style="color:#0000FF; font-weight:bold;">true</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> greet
    <span style="color:#996600;">&quot;Hi, I'm #{self.name}, woof woof!&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>




<h3>Our Example Spec</h3>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">describe Dog <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
  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:#9966CC; font-weight:bold;">do</span>
    <span style="color:#0066ff; font-weight:bold;">@animal</span> = Dog.<span style="color:#9900CC;">new</span>
    <span style="color:#0066ff; font-weight:bold;">@animal</span>.<span style="color:#9900CC;">name</span> = <span style="color:#996600;">&quot;Bruno&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  it_should_behave_like <span style="color:#996600;">&quot;a mammal&quot;</span>
&nbsp;
  describe <span style="color:#996600;">&quot;Greet&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    it <span style="color:#996600;">&quot;should respond with its name and a greeting&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      <span style="color:#0066ff; font-weight:bold;">@animal</span>.<span style="color:#9900CC;">greet</span>.<span style="color:#9900CC;">should</span> == <span style="color:#996600;">&quot;Hi, I'm Bruno, woof woof!&quot;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>




<h3>Our Shared Spec</h3>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">describe <span style="color:#996600;">&quot;a mammal&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:shared</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  it <span style="color:#996600;">&quot;should really be a mammal&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    <span style="color:#0066ff; font-weight:bold;">@animal</span>.<span style="color:#9900CC;">mammal</span>.<span style="color:#9900CC;">should</span> be_true
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>




<h3>A Typical <code>before(:each)</code></h3>

<p>Typically, when you&#8217;ve got a describe block, you might use <code>before(:each)</code> to setup some scenario that is used for each spec in that describe block, pretty normal RSpec stuff. We&#8217;re using it above in our example spec to create a new Dog object and set that dog&#8217;s name.</p>

<h3>Using <code>before(:each)</code> in a shared spec</h3>

<p>What if you wanted to use a <code>before(:each)</code> in your shared spec? Expanding on our example above we can do something like this.</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">describe <span style="color:#996600;">&quot;a mammal&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:shared</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</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:#9966CC; font-weight:bold;">do</span>
    <span style="color:#0066ff; font-weight:bold;">@animal</span>.<span style="color:#9900CC;">stub</span>!<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:has_body_hair</span>?<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">and_return</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">true</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
  it <span style="color:#996600;">&quot;should really be a mammal&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    <span style="color:#0066ff; font-weight:bold;">@animal</span>.<span style="color:#9900CC;">mammal</span>.<span style="color:#9900CC;">should</span> be_true
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>




<p>Based on typical RSpec behavior, one would think that the stubbing of the <code>has_by_hair?</code> method on the instance of an animal, would only apply to the specs inside of the <code>describe</code> block of the shared example group. <strong>However, by specifying in the Dog spec that a dog &#8220;should behave like&#8221; a mammal, and thus using the shared spec, that stub will apply to all subsequent &#8220;it should&#8221; blocks in your model spec.</strong></p>

<p>What if, for example, we had the following in our Dog spec.</p>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  describe <span style="color:#996600;">&quot;Mutate into Lizard Dog&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
   <span style="color:#008000; font-style:italic;"># dog.mutate will remove body hair and make the dog cold blooded</span>
    it <span style="color:#996600;">&quot;should mutate into a new species&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      <span style="color:#0066ff; font-weight:bold;">@animal</span>.<span style="color:#9900CC;">mutate</span>
      <span style="color:#0066ff; font-weight:bold;">@animal</span>.<span style="color:#9900CC;">has_body_hair</span>?.<span style="color:#9900CC;">should</span> be_false
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>




<p>If we include this in our Dog spec, below the inclusion of the shared example spec, our test will fail. We&#8217;ve already stubbed out the <code>has_body_hair?</code> method as part of our shared example group, when we call it down here in this completely separate describe block, RSpec is just using the stub we setup previously.</p>

<h3>It might be a design problem if&#8230;</h3>

<p>Now while I&#8217;m considering this a gotcha, it may be that this is expected behavior, I couldn&#8217;t find anything specifically when researching this &#8220;bug&#8221; originally. It is also possible that stubbing behavior in shared example groups is frowned upon, and I&#8217;m just &#8220;doing it wrong&#8221;.</p>

<p>Ultimately, I tried using patterns that made sense to me and seemed to be in line with how RSpec works in general. A stubbed method inside the <code>before(:each)</code> of a describe block is usually only applicable to the specs and nested describes contained within. When I realized that this is <em>not</em> the case with shared example groups, it seemed like a gotcha.</p><img src="http://feeds.feedburner.com/~r/claytonlengelzigich/~4/FzNN_8o22Dk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.claytonlz.com/index.php/2009/03/rspec-shared-example-before-each-gotcha/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.claytonlz.com/index.php/2009/03/rspec-shared-example-before-each-gotcha/</feedburner:origLink></item>
		<item>
		<title>FIX: GoDaddy VPS 554 too many hops Error</title>
		<link>http://feedproxy.google.com/~r/claytonlengelzigich/~3/IFq1Xolpw6s/</link>
		<comments>http://www.claytonlz.com/index.php/2009/03/fix-godaddy-vps-554-too-many-hops-error/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 04:49:23 +0000</pubDate>
		<dc:creator>Clayton</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Fix]]></category>
		<category><![CDATA[GoDaddy]]></category>
		<category><![CDATA[PLESK]]></category>
		<category><![CDATA[Qmail]]></category>

		<guid isPermaLink="false">http://www.claytonlz.com/?p=121</guid>
		<description><![CDATA[Here's a quick fix for the "Remote host said: 554 too many hops, this message is looping (#5.4.6)" error message you might get when trying to send an e-mail to an e-mail address configured in PLESK on a GoDaddy Linux VPS running Qmail.]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick fix for the &#8220;Remote host said: 554 too many hops, this message is looping (#5.4.6)&#8221; error message you might get when trying to send an e-mail to an e-mail address configured in <span class="caps">PLESK </span>on a GoDaddy Linux <span class="caps">VPS </span>running Qmail.</p>


<ol>
<li><span class="caps">SSH</span> Into your GoDaddy <span class="caps">VPS</span></li>
<li>Copy the file located at <code>/var/qmail/control/smtproutes</code> to <code>/var/qmail/control/smtproutes.old</code></li>
<li>Open the file located at <code>/var/qmail/control/smtproutes</code></li>
<li>Delete its contents</li>
</ol>



<p>I believe this will only work if you&#8217;re not using GoDaddy to host any of your e-mail and you only want your <span class="caps">VPS </span>and <span class="caps">PLESK </span>(running Qmail) to be responsible for hosting your e-mail.</p>

<p>More information and the original fix can be found here: http://www.datapencil.com/horde.htm</p><img src="http://feeds.feedburner.com/~r/claytonlengelzigich/~4/IFq1Xolpw6s" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.claytonlz.com/index.php/2009/03/fix-godaddy-vps-554-too-many-hops-error/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.claytonlz.com/index.php/2009/03/fix-godaddy-vps-554-too-many-hops-error/</feedburner:origLink></item>
		<item>
		<title>It’s Really All About the People</title>
		<link>http://feedproxy.google.com/~r/claytonlengelzigich/~3/B_uNeVtJUxo/</link>
		<comments>http://www.claytonlz.com/index.php/2009/02/its-really-all-about-the-people/#comments</comments>
		<pubDate>Sat, 28 Feb 2009 20:00:09 +0000</pubDate>
		<dc:creator>Clayton</dc:creator>
				<category><![CDATA[Ideas]]></category>
		<category><![CDATA[Integrum]]></category>
		<category><![CDATA[management]]></category>
		<category><![CDATA[people]]></category>
		<category><![CDATA[process]]></category>

		<guid isPermaLink="false">http://www.claytonlz.com/?p=112</guid>
		<description><![CDATA[Last week at "Integrum":http://www.integrumtech.com, as part of our ongoing effort to be _the best_, we had a retrospective/company-wide expectation meeting. We discussed our current processes, and outlined some new things we wanted to do going forward that would help improve everything we do. Even though we talked a lot about project boards and velocities, when it comes down to it, it's really all about the people.]]></description>
			<content:encoded><![CDATA[<p>Last week at <a href="http://www.integrumtech.com">Integrum</a>, as part of our ongoing effort to be <em>the best</em>, we had a retrospective/company-wide expectation meeting. We discussed our current processes, and outlined some new things we wanted to do going forward that would help improve everything we do. Even though we talked a lot about project boards and velocities, when it comes down to it, it&#8217;s really all about the people.</p>

<h3>How to Earn a Gold Card</h3>

<p>When I was in <a href="http://www.pacificschool.com/">elementary school</a> they had an ongoing school-wide program where students could earn &#8220;Gold Cards&#8221; and be recognized in the monthly assemblies. To earn a Gold Card, one had to be doing something benefiting others, <em>without</em> being asked. It could be something as simple as going out of your way to pickup some trash.</p>

<p>To be sure, a lot of students went around doing very insignificant, but still beneficial, activities all day in hopes of being seen by a teacher. The real takeaway however was the idea that the best type of deed is done where no one is watching. This is a difficult concept for a 4th grader, but the life lesson is outstanding.</p>

<h3>Focus on the People</h3>

<p>We talk a lot at Integrum about our process, our engineering principles, our goals, plans and expectations. But for every project board, velocity graph, client stand-up and piece of acceptance criteria, there is an underlying foundation of high quality people working together to achieve a common goal. Finding trustworthy, forgiving, understanding, motivating, helpful, challenging and comforting people to work with removes so many of the problems that these project management tools aim to solve.</p>

<p>When people live their lives being accountable to themselves and those around them, when they strive to do what&#8217;s right, even when it&#8217;s hard, and when they go above and beyond without the expectation of being praised, they can achieve great things.</p><img src="http://feeds.feedburner.com/~r/claytonlengelzigich/~4/B_uNeVtJUxo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.claytonlz.com/index.php/2009/02/its-really-all-about-the-people/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.claytonlz.com/index.php/2009/02/its-really-all-about-the-people/</feedburner:origLink></item>
		<item>
		<title>Flog as a Surrogate Pair</title>
		<link>http://feedproxy.google.com/~r/claytonlengelzigich/~3/lAt7nX-pyz4/</link>
		<comments>http://www.claytonlz.com/index.php/2009/02/flog-as-a-surrogate-pair/#comments</comments>
		<pubDate>Sat, 28 Feb 2009 17:00:06 +0000</pubDate>
		<dc:creator>Clayton</dc:creator>
				<category><![CDATA[Ideas]]></category>
		<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[Flog]]></category>
		<category><![CDATA[pair programming]]></category>

		<guid isPermaLink="false">http://www.claytonlz.com/?p=108</guid>
		<description><![CDATA[I'm a fan of "Flog":http://ruby.sadi.st/Flog.html. I like using it every now and then to make sure that I'm not getting too complex, trying to be clever, or setting myself up for testing failure. Typically these are things I look to my "MILF slaying pair":http://twitter.com/supairish for guidance, but sometimes Flog can be just as good.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a fan of <a href="http://ruby.sadi.st/Flog.html">Flog</a>. I like using it every now and then to make sure that I&#8217;m not getting too complex, trying to be clever, or setting myself up for testing failure. Typically these are things I look to my <a href="http://twitter.com/supairish"><span class="caps">MILF </span>slaying pair</a> for guidance, but sometimes Flog can be just as good.</p>

<p>As a relative newcomer to Ruby, I&#8217;m still in the process of learning to identify code smells, poor design and needless complexity. I&#8217;m sold on the &#8220;readable code is better&#8221; idea so I try to keep that in mind as I&#8217;m implementing some piece of functionality. Over at <a href="http://www.integrumtech.com">Integrum</a>, where I work, we pair on everything each day, save for the occasional sick day. Today I was working alone and was reviewing some code that my pair and I had wrote about a week earlier. It was complex, and I feel that we made a compromise with the idea that the &#8220;ugly&#8221; working code was good enough for what we needed at the time, but it was ugly enough that I remembered to revisit it.</p>

<h3>Flog Builds Confidence</h3>

<p>When I really started looking at the code my intuition told me that it needed to be re-factored. I knew that it could be improved, but I suppose I&#8217;ve been in the pair mindset so heavily since I&#8217;ve been here that I did not immediately jump in and fix things. However, when I ran Flog and saw the comparatively high scores for two complex methods I had been investigating, I had that supportive &#8220;yea I agree&#8221; feeling that I usually get from pairing. Flog helped push me over the threshold, from &#8220;maybe I should change this&#8221; to &#8220;this should be changed&#8221;.</p>

<p>This isn&#8217;t to say that I <em>wouldn&#8217;t</em> have changed it without Flog, but it gave me that extra confidence in knowing that I was on the right track. The direct benefit was that the code is now more readable and easier to test. Indirectly I&#8217;ve added another point to my mental Ruby experience score and will be more inclined to follow my intuition in the future.</p><img src="http://feeds.feedburner.com/~r/claytonlengelzigich/~4/lAt7nX-pyz4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.claytonlz.com/index.php/2009/02/flog-as-a-surrogate-pair/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.claytonlz.com/index.php/2009/02/flog-as-a-surrogate-pair/</feedburner:origLink></item>
		<item>
		<title>Installing LaTeX packages on Ubuntu for RTeX Gem</title>
		<link>http://feedproxy.google.com/~r/claytonlengelzigich/~3/TBRxzbGRQ8o/</link>
		<comments>http://www.claytonlz.com/index.php/2009/02/installing-latex-packages-on-ubuntu-for-rtex-gem/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 01:27:49 +0000</pubDate>
		<dc:creator>Clayton</dc:creator>
				<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[RTeX]]></category>
		<category><![CDATA[torture]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.claytonlz.com/?p=99</guid>
		<description><![CDATA[Looking for a really confusing and cryptic layout language for generating PDFs through your rails app? If you enjoy nonsensical markup languages and have the urge to read poorly written how-to documents from 1995, say hello to LaTeX! Unfortunately LaTeX can be slightly difficult to configure, but with a little help from apt-get, you can make your life easier.]]></description>
			<content:encoded><![CDATA[<p>Looking for a really confusing and cryptic layout language for generating <span class="caps">PDF</span>s through your rails app? If you enjoy nonsensical markup languages and have the urge to read poorly written how-to documents from 1995, say hello to LaTeX! Unfortunately LaTeX can be slightly difficult to configure, but with a little help from apt-get, you can make your life easier.</p>

<h3>Packages Needed on Ubuntu</h3>

<p>I&#8217;ve tried the following on Ubuntu Intrepid Ibex 8.10 but I would imagine that it works on other recent versions as well.</p>

<p>First let&#8217;s search for available texlive related packages</p>


<pre>
$&gt; apt-cache search ^texlive
texlive - TeX Live: A decent selection of the TeX Live packages
texlive-base - TeX Live: Essential programs and files
texlive-base-bin - TeX Live: Essential binaries
texlive-base-bin-doc - TeX Live: Documentation files for texlive-base-bin
texlive-bibtex-extra - TeX Live: Extra BibTeX styles
texlive-common - TeX Live: Base component
... snip...
texlive-plain-extra - TeX Live: Plain TeX supplementary packages
texlive-science - TeX Live: Typesetting for natural and computer sciences
</pre>



<p>You&#8217;ll notice that there are a <em>lot</em> of packages available. Now, you could go through and probably piece together the exact set of packages you need, or you could just do this&#8230;</p>



<pre>
$&gt; apt-get install texlive-full
</pre>



<p>This will install <em>everything</em>, docs, languages, fonts, advanced math typesetting, you&#8217;ll even be able to generate <span class="caps">PDF</span>s in Mongolian. All of the packages together are about 1.1GB, and it takes a long time to download/build, but avoiding the apt-get hassle is worth it.</p>

<h3>RTex Gem for Rails Support</h3>

<p>If you&#8217;re planning on using a LaTeX template to generate a <span class="caps">PDF </span>in your rails app, you&#8217;ll need to make use of the <a href="http://rtex.rubyforge.org/manual/install.html">RTeX gem</a>. Once you&#8217;ve got the RTeX gem installed, create the view for your ActiveRecord model.</p>

<p>In this example application, we have an invoice model. We want an employee to be able to view the LaTeX generated invoice by accessing something like http://localhost:3000/invoices/1.pdf</p>

<p>Our controller is pretty straightforward.</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> InvoiceController <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActionController::Base</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> show
    <span style="color:#0066ff; font-weight:bold;">@invoice</span> = Invoice.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span>params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:id</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>




<p>Next we need to create a view that will store the LaTeX markup that creates our <span class="caps">PDF.</span></p>


<pre>
$&gt; touch app/views/invoices/show.pdf.rtex
</pre>



<p>Once you&#8217;ve pulled your hair out writing the LaTeX markup required to get the invoice <span class="caps">PDF </span>looking the way you want, save the LaTeX to the show file you&#8217;ve just created in <code>app/views/invoices/show.pdf.rtex</code></p>

<h3>Drink a Beer</h3>

<p>You should now be able to access your pretty LaTeX formatted <span class="caps">PDF </span>invoice @ http://localhost:3000/invoices/1.pdf</p><img src="http://feeds.feedburner.com/~r/claytonlengelzigich/~4/TBRxzbGRQ8o" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.claytonlz.com/index.php/2009/02/installing-latex-packages-on-ubuntu-for-rtex-gem/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.claytonlz.com/index.php/2009/02/installing-latex-packages-on-ubuntu-for-rtex-gem/</feedburner:origLink></item>
	</channel>
</rss>
