<?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>Blog &#124; Rubyyot &#187; Rails</title>
	<atom:link href="http://blog.rubyyot.com/category/programming/rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.rubyyot.com</link>
	<description>Programming, Pragmatism and Getting By in the World</description>
	<lastBuildDate>Wed, 24 Mar 2010 00:14:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Railsbridge BugMash on now</title>
		<link>http://blog.rubyyot.com/2010/01/railsbridge-bugmash-on-now/</link>
		<comments>http://blog.rubyyot.com/2010/01/railsbridge-bugmash-on-now/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 22:16:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[bugmash]]></category>
		<category><![CDATA[rails 3.0pre]]></category>
		<category><![CDATA[railsbridge]]></category>

		<guid isPermaLink="false">http://blog.rubyyot.com/?p=704</guid>
		<description><![CDATA[Railsbridge BugMash
The call went out the other day for participants in the Rails 3.0pre BugMash on Jan 16th &#8211; 17th.  Included were some imple instructions for cloning Rails 3 and creating a new Rails app from it.  So I pulled it down and gave Rails 3 a test spin.
Project
I decided to start a [...]]]></description>
			<content:encoded><![CDATA[<h3>Railsbridge BugMash</h3>
<p>The call went out the other day for participants in the <a href="http://railsbridge.org/news_items/10" target="_blank">Rails 3.0pre BugMash</a> on Jan 16th &#8211; 17th.  Included were some imple instructions for cloning Rails 3 and creating a new Rails app from it.  So I pulled it down and gave Rails 3 a test spin.</p>
<h3>Project</h3>
<p>I decided to start a project for making a sort of universal friends list.  One that encorporates XFN tags and OpenID.  The data could then be used as a resource for other sites to seed a friends list.  In order to claim an OpenID as your own you need to authenticate it.</p>
<h3>Bundler</h3>
<p>The first thing I noticed was the existance of the <a href="http://github.com/rubyyot/knowyou/blob/bugmash/Gemfile" target="_blank">Gemfile</a> in the rails root and how empty <a href="http://github.com/rubyyot/knowyou/blob/bugmash/config/environment.rb" target="_blank">config/environment.rb</a> is.  I&#8217;d read on about the new bundler and thought it was going to be painful, but I was wrong, it was actually a joy.  It even removed gem after I commented out the requirement statement in the Gemfile.</p>
<h3>Plugins</h3>
<p>I installed Authlogic as a plugin, after failing to get it working as a gem.  I&#8217;ve had the same issue with Rails 2.3 so I don&#8217;t think this is an issue with Rails 3.  The OpenId Authentication plugin worked fine as well.</p>
<h3>Routes</h3>
<p>The new routing module took a little getting used to, but after a few mistakes I got it working correctly.  In the end <a href="http://github.com/rubyyot/knowyou/blob/bugmash/config/routes.rb" target="_blank">config/routes.rb</a> looks much cleaner, and still contains lots of commented samples.  Also the legacy routing is commented by default, which is nice since that&#8217;s something I do anyway.</p>
<h3>Premade .gitignore</h3>
<p>Speaking of nice defaults, creating the rails app made .gitignore file for me with tmp / db / log already in it.  Very Nice!</p>
<h3>View validation</h3>
<p>One thing that came as a bit of a surprise to me that the views are validated against the models.  If you reference a field on the model in the view that does not exist, Rails will now error and tell you that it&#8217;s not there.  So you need to rake db:migrate to have it recognize the fields on a model.</p>
<h3>Conclusion</h3>
<p>I have really liked what I see of Rails 3 thus far.  Thanks to all those that have worked on it.  I think that I will start using this version by default.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rubyyot.com/2010/01/railsbridge-bugmash-on-now/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chores: A test driven website &#8211; Part 10</title>
		<link>http://blog.rubyyot.com/2009/06/chores-a-test-driven-website-part-10/</link>
		<comments>http://blog.rubyyot.com/2009/06/chores-a-test-driven-website-part-10/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 02:58:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Chores]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[known state]]></category>

		<guid isPermaLink="false">http://blog.rubyyot.com/?p=636</guid>
		<description><![CDATA[Where was I?
By the time I finished up post nine and started working on post 10, I was completely lost.  It was entirely my fault and it happens to the best of us, and me too.  Coming back to the Chores app after time had passed, and looking around, I thought two things:

How [...]]]></description>
			<content:encoded><![CDATA[<h3>Where was I?</h3>
<p>By the time I finished up <a href="http://blog.rubyyot.com/2009/05/chores-a-test-driven-website-part-10/" rel="me" target="_blank">post nine</a> and started working on post 10, I was completely lost.  It was entirely my fault and it happens to the best of us, and me too.  Coming back to the Chores app after time had passed, and looking around, I thought two things:</p>
<ul>
<li>How did this get to be such a mess?</li>
<li>Where was I?</li>
</ul>
<p>A number of factors had come into play that led to this point.  The first of which was lack of discipline.  As came across features I thought were interesting or necessary, I abandoned the test driven mantra of <a href="http://geekswithblogs.net/WillSmith/archive/2008/03/18/red-green-refactor.aspx" target="_blank">red, green, refactor</a>.  This ruined my focus, splintered my development efforts and generated a fair share of untested code.</p>
<p>Another issue I ran into is that over the time between my first posts and now, a number of new versions of libraries were released and Rails itself moved from version 2.2.2 to 2.3.2.  Subtle variations in the APIs for these gems, generated a few errors and left me scratching my head more than once.  I would like to say that <em>change is good</em></strong>, it&#8217;s great that the Ruby community is so active in improving it&#8217;s products.  However, I needed to be more proactive in managing the changes.</p>
<p>Time is another factor that worked it&#8217;s entropy in Chores.  You hear people talking about the poor developer left to maintain sloppy code months or years after it&#8217;s release, and that they may be you.  Well it was me, and I was feeling the hurt.</p>
<h3>Not all is lost</h3>
<p>Thus far, I&#8217;ve painted a pretty dire picture of the state of the code.  I&#8217;ve probably left you thinking, &#8220;but this is Chores: A test driven website!  How could this happen?&#8221;  Well it does happen, but you are right. On the bright side, it is a test driven website.  If it wasn&#8217;t I would probably be tempted to toss it out and start over.  But, because it&#8217;s test driven and in source control, I&#8217;m fairly confident that I can get the codebase up to date and functional in a reasonable amount of time.   This in addition to a few practices will have me back in business in no time</p>
<ul>
<li><a href="http://blog.rubyyot.com/2009/05/configuring-gems-for-your-rails-app/" target="_blank" rel="me">Configuring gems for Rails</a> &#8211; Manage dependencies by documenting the gems you are using and requiring certain versions.  You can also <a href="http://railscasts.com/episodes/110-gem-dependencies" target="_blank">freeze a version</a> of each to your app.</li>
<li><a href="http://blog.hasmanythrough.com/2008/12/18/agile-git-and-the-story-branch-pattern" target="_blank">Git branches for new features</a> &#8211; create a new branch for a new feature to help stay focused. </li>
<li><a href="http://blog.rubyyot.com/2009/05/gtd-on-rails-with-annotations/" target="_blank" rel="me">When inspiration strikes, annotate!</a> &#8211; Rather than getting sidetracked by things outside of the scope of the current feature, leave a note and come back to it.</li>
</ul>
<p> While these are good practices to follow in the future, what can I do to get this codebase back under control?
<ul>
<li><strong>Git back to known state</strong> &#8211; Since I&#8217;ve done some unknown piecemeal development on chores I will use my post_9 tag.</li>
<li><strong>Make sure existing tests pass</strong> &#8211; This is where our tests are worth their weight.  We know what code is working, and what that code does.</li>
<li><strong>Evaluate holes</strong> &#8211; Find the weak points in the tests and make a plan to fix them. </li>
</ul>
<h3>Git Happy</h3>
<p><em><strong>Note</strong>: You can <a href="http://github.com/rubyyot/chores/tree/post_9" target="_blank">find post_9 here</a>, though if you happen to be following along, you would want to merge it into your own source.</em></p>
<p>My first step is to rewind to the tag I made for my last post.  Right away I realise that I now have two source repositories, one on my shared host and one on github.  One is really enough so part of the process will be to move to only github.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git status
<span style="color: #666666; font-style: italic;"># On branch master</span>
<span style="color: #666666; font-style: italic;"># Your branch is ahead of 'origin/master' by 4 commits.</span>
<span style="color: #666666; font-style: italic;">#</span>
nothing to commit <span style="color: #7a0874; font-weight: bold;">&#40;</span>working directory clean<span style="color: #7a0874; font-weight: bold;">&#41;</span>
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git remote
github
origin
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git remote <span style="color: #c20cb9; font-weight: bold;">rm</span> origin
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git remote
github
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git remote add origin   git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>rubyyot<span style="color: #000000; font-weight: bold;">/</span>chores.git</pre></div></div>

<p>Above, I listed my remote repositories.  I see that I have two, so I remove one and add another.  A mistake I made here is that I set my remote to my public clone url.  I should have, since I will be pushing to it, used my clone url, git@github.com:rubyyot/chores.git. </p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git status
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git reset <span style="color: #660033;">--hard</span> post_9
HEAD is now at b0eecae added auto formatting to Identity.find_or_create_if_valid</pre></div></div>

<p>Here I have done a hard (destructive) reset back to the tag post_9.  I could have avoided doing such a dangerous procedure if I had been working on a branch. </p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git status
<span style="color: #666666; font-style: italic;"># On branch master</span>
<span style="color: #666666; font-style: italic;"># Untracked files:</span>
<span style="color: #666666; font-style: italic;">#   (use &quot;git add &lt;file&gt;...&quot; to include in what will be committed)</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#       db/production.sqlite3</span>
nothing added to commit but untracked files present <span style="color: #7a0874; font-weight: bold;">&#40;</span>use <span style="color: #ff0000;">&quot;git add&quot;</span> to track<span style="color: #7a0874; font-weight: bold;">&#41;</span>
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ <span style="color: #c20cb9; font-weight: bold;">vi</span> .gitignore      <span style="color: #666666; font-style: italic;">#added db/*.sqlite3 to .gitignore</span>
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git status
<span style="color: #666666; font-style: italic;"># On branch master</span>
<span style="color: #666666; font-style: italic;"># Changed but not updated:</span>
<span style="color: #666666; font-style: italic;">#   (use &quot;git add &lt;file&gt;...&quot; to update what will be committed)</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#       modified:   .gitignore</span>
<span style="color: #666666; font-style: italic;">#</span>
no changes added to commit <span style="color: #7a0874; font-weight: bold;">&#40;</span>use <span style="color: #ff0000;">&quot;git add&quot;</span> and<span style="color: #000000; font-weight: bold;">/</span>or <span style="color: #ff0000;">&quot;git commit -a&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>Here I noticed that git sees my &#8220;production&#8221; sqlite3 database is not in sync with the index.   I really don&#8217;t want or need to have a pseudo-production sqlite3 database in source control so I updated my .gitignore file to ignore it. </p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ rake <span style="color: #7a0874; font-weight: bold;">test</span>
<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>rubyyot<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby1.8 <span style="color: #660033;">-I</span><span style="color: #ff0000;">&quot;/home/rubyyot/working/chores/lib&quot;</span> <span style="color: #660033;">-I</span><span style="color: #ff0000;">&quot;/home/rubyyot/working/chores/test&quot;</span> <span style="color: #ff0000;">&quot;/home/rubyyot/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake/rake_test_loader.rb&quot;</span> <span style="color: #ff0000;">&quot;test/unit/identity_test.rb&quot;</span> <span style="color: #ff0000;">&quot;test/unit/chore_test.rb&quot;</span> <span style="color: #ff0000;">&quot;test/unit/child_test.rb&quot;</span>
Loaded suite <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>rubyyot<span style="color: #000000; font-weight: bold;">/</span>.gem<span style="color: #000000; font-weight: bold;">/</span>ruby<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.8</span><span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span>rake-0.8.4<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>rake<span style="color: #000000; font-weight: bold;">/</span>rake_test_loader
Started
.............................
Finished <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000;">0.347031</span> seconds.
&nbsp;
<span style="color: #000000;">29</span> tests, <span style="color: #000000;">43</span> assertions, <span style="color: #000000;">0</span> failures, <span style="color: #000000;">0</span> errors
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby1.8 <span style="color: #660033;">-I</span><span style="color: #ff0000;">&quot;/home/rubyyot/working/chores/lib&quot;</span> <span style="color: #660033;">-I</span><span style="color: #ff0000;">&quot;/home/rubyyot/working/chores/test&quot;</span> <span style="color: #ff0000;">&quot;/home/rubyyot/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake/rake_test_loader.rb&quot;</span> <span style="color: #ff0000;">&quot;test/functional/children_controller_test.rb&quot;</span> <span style="color: #ff0000;">&quot;test/functional/chores_controller_test.rb&quot;</span> <span style="color: #ff0000;">&quot;test/functional/home_controller_test.rb&quot;</span>
Loaded suite <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>rubyyot<span style="color: #000000; font-weight: bold;">/</span>.gem<span style="color: #000000; font-weight: bold;">/</span>ruby<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.8</span><span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span>rake-0.8.4<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>rake<span style="color: #000000; font-weight: bold;">/</span>rake_test_loader
Started
..........
Finished <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000;">0.201701</span> seconds.
&nbsp;
<span style="color: #000000;">10</span> tests, <span style="color: #000000;">17</span> assertions, <span style="color: #000000;">0</span> failures, <span style="color: #000000;">0</span> errors
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby1.8 <span style="color: #660033;">-I</span><span style="color: #ff0000;">&quot;/home/rubyyot/working/chores/lib&quot;</span> <span style="color: #660033;">-I</span><span style="color: #ff0000;">&quot;/home/rubyyot/working/chores/test&quot;</span> <span style="color: #ff0000;">&quot;/home/rubyyot/.gem/ruby/1.8/gems/rake-0.8.4/lib/rake/rake_test_loader.rb&quot;</span>
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ rake features
<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>rubyyot<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby1.8 <span style="color: #660033;">-I</span> <span style="color: #ff0000;">&quot;/usr/lib/ruby/gems/1.8/gems/cucumber-0.3.11/lib:lib&quot;</span> <span style="color: #ff0000;">&quot;/usr/lib/ruby/gems/1.8/gems/cucumber-0.3.11/bin/cucumber&quot;</span> <span style="color: #660033;">--format</span> pretty features<span style="color: #000000; font-weight: bold;">/</span>define_children.feature features<span style="color: #000000; font-weight: bold;">/</span>define_chores.feature
Story:  Define child
As a parent
I want to define my child<span style="color: #7a0874; font-weight: bold;">&#40;</span>ren<span style="color: #7a0874; font-weight: bold;">&#41;</span>
So that I can assign them chores
&nbsp;
  Scenario: Defining a child                                        <span style="color: #666666; font-style: italic;"># features/define_children.feature:6</span>
    Given I am logged <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #c20cb9; font-weight: bold;">as</span> <span style="color: #ff0000;">&quot;test.example.com&quot;</span>                      <span style="color: #666666; font-style: italic;"># features/step_definitions/chores_steps.rb:9</span>
    And I am on the homepage                                        <span style="color: #666666; font-style: italic;"># features/step_definitions/webrat_steps.rb:6</span>
    When I follow <span style="color: #ff0000;">&quot;Add Child&quot;</span>                                       <span style="color: #666666; font-style: italic;"># features/step_definitions/webrat_steps.rb:18</span>
    And I fill <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #ff0000;">&quot;child[nickname]&quot;</span> with <span style="color: #ff0000;">&quot;Bobby&quot;</span>                    <span style="color: #666666; font-style: italic;"># features/step_definitions/webrat_steps.rb:22</span>
    And I fill <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #ff0000;">&quot;child[open_identifier]&quot;</span> with <span style="color: #ff0000;">&quot;bobby.example.com&quot;</span> <span style="color: #666666; font-style: italic;"># features/step_definitions/webrat_steps.rb:22</span>
    And I press <span style="color: #ff0000;">&quot;Add&quot;</span>                                               <span style="color: #666666; font-style: italic;"># features/step_definitions/webrat_steps.rb:14</span>
    Then I should see <span style="color: #ff0000;">&quot;Child added.&quot;</span>                                <span style="color: #666666; font-style: italic;"># features/step_definitions/webrat_steps.rb:93</span>
    And I should see <span style="color: #ff0000;">&quot;Bobby&quot;</span>                                        <span style="color: #666666; font-style: italic;"># features/step_definitions/webrat_steps.rb:93</span>
&nbsp;
  Scenario: Defining a second child                                 <span style="color: #666666; font-style: italic;"># features/define_children.feature:16</span>
    Given I am logged <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #c20cb9; font-weight: bold;">as</span> <span style="color: #ff0000;">&quot;test.example.com&quot;</span>                      <span style="color: #666666; font-style: italic;"># features/step_definitions/chores_steps.rb:9</span>
    And I am on the homepage                                        <span style="color: #666666; font-style: italic;"># features/step_definitions/webrat_steps.rb:6</span>
    When I follow <span style="color: #ff0000;">&quot;Add Child&quot;</span>                                       <span style="color: #666666; font-style: italic;"># features/step_definitions/webrat_steps.rb:18</span>
    And I fill <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #ff0000;">&quot;child[nickname]&quot;</span> with <span style="color: #ff0000;">&quot;Bobby&quot;</span>                    <span style="color: #666666; font-style: italic;"># features/step_definitions/webrat_steps.rb:22</span>
    And I fill <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #ff0000;">&quot;child[open_identifier]&quot;</span> with <span style="color: #ff0000;">&quot;bobby.example.com&quot;</span> <span style="color: #666666; font-style: italic;"># features/step_definitions/webrat_steps.rb:22</span>
    And I press <span style="color: #ff0000;">&quot;Add&quot;</span>                                               <span style="color: #666666; font-style: italic;"># features/step_definitions/webrat_steps.rb:14</span>
    And I follow <span style="color: #ff0000;">&quot;Add another Child&quot;</span>                                <span style="color: #666666; font-style: italic;"># features/step_definitions/webrat_steps.rb:18</span>
    And I fill <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #ff0000;">&quot;child[nickname]&quot;</span> with <span style="color: #ff0000;">&quot;Suzy&quot;</span>                     <span style="color: #666666; font-style: italic;"># features/step_definitions/webrat_steps.rb:22</span>
    And I fill <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #ff0000;">&quot;child[open_identifier]&quot;</span> with <span style="color: #ff0000;">&quot;suzy.example.com&quot;</span>  <span style="color: #666666; font-style: italic;"># features/step_definitions/webrat_steps.rb:22</span>
    And I press <span style="color: #ff0000;">&quot;Add&quot;</span>                                               <span style="color: #666666; font-style: italic;"># features/step_definitions/webrat_steps.rb:14</span>
    Then I should see <span style="color: #ff0000;">&quot;Child added.&quot;</span>                                <span style="color: #666666; font-style: italic;"># features/step_definitions/webrat_steps.rb:93</span>
    And I should see <span style="color: #ff0000;">&quot;Bobby&quot;</span>                                        <span style="color: #666666; font-style: italic;"># features/step_definitions/webrat_steps.rb:93</span>
    And I should see <span style="color: #ff0000;">&quot;Suzy&quot;</span>                                         <span style="color: #666666; font-style: italic;"># features/step_definitions/webrat_steps.rb:93</span>
&nbsp;
Story:  Define chores
As a parent
I want to define chores
So that I can assign them to my children
&nbsp;
  Scenario: Creating a chore                      <span style="color: #666666; font-style: italic;"># features/define_chores.feature:6</span>
    Given I am logged <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #c20cb9; font-weight: bold;">as</span> <span style="color: #ff0000;">&quot;test.example.com&quot;</span>    <span style="color: #666666; font-style: italic;"># features/step_definitions/chores_steps.rb:9</span>
    And I am on the homepage                      <span style="color: #666666; font-style: italic;"># features/step_definitions/webrat_steps.rb:6</span>
    When I follow <span style="color: #ff0000;">&quot;Add Chore&quot;</span>                     <span style="color: #666666; font-style: italic;"># features/step_definitions/webrat_steps.rb:18</span>
    And I fill <span style="color: #000000; font-weight: bold;">in</span> the chore with <span style="color: #ff0000;">&quot;My first chore&quot;</span> <span style="color: #666666; font-style: italic;"># features/step_definitions/chores_steps.rb:5</span>
    And I press <span style="color: #ff0000;">&quot;Add&quot;</span>                             <span style="color: #666666; font-style: italic;"># features/step_definitions/webrat_steps.rb:14</span>
    Then I should see <span style="color: #ff0000;">&quot;Chore added.&quot;</span>              <span style="color: #666666; font-style: italic;"># features/step_definitions/webrat_steps.rb:93</span>
    And I should see <span style="color: #ff0000;">&quot;My first chore&quot;</span>             <span style="color: #666666; font-style: italic;"># features/step_definitions/webrat_steps.rb:93</span>
&nbsp;
<span style="color: #000000;">3</span> scenarios <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">3</span> passed<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000;">28</span> steps <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">28</span> passed<span style="color: #7a0874; font-weight: bold;">&#41;</span>
0m0.266s</pre></div></div>

<p>Now I&#8217;ve run my tests and features and am pleasantly surprised to see that they are all passing.  I didn&#8217;t expect this, but it&#8217;s a pleasant surprise.  Still there could be some hidden surprises lurking in the shadows. </p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git status
<span style="color: #666666; font-style: italic;"># On branch master</span>
<span style="color: #666666; font-style: italic;"># Changed but not updated:</span>
<span style="color: #666666; font-style: italic;">#   (use &quot;git add &lt;file&gt;...&quot; to update what will be committed)</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#       modified:   .gitignore</span>
<span style="color: #666666; font-style: italic;">#       modified:   db/test.sqlite3</span>
<span style="color: #666666; font-style: italic;">#</span>
no changes added to commit <span style="color: #7a0874; font-weight: bold;">&#40;</span>use <span style="color: #ff0000;">&quot;git add&quot;</span> and<span style="color: #000000; font-weight: bold;">/</span>or <span style="color: #ff0000;">&quot;git commit -a&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span> db<span style="color: #000000; font-weight: bold;">/</span>test.sqlite3
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #ff0000;">'db/test.sqlite3'</span>
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git status
<span style="color: #666666; font-style: italic;"># On branch master</span>
<span style="color: #666666; font-style: italic;"># Changes to be committed:</span>
<span style="color: #666666; font-style: italic;">#   (use &quot;git reset HEAD &lt;file&gt;...&quot; to unstage)</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#       deleted:    db/test.sqlite3</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Changed but not updated:</span>
<span style="color: #666666; font-style: italic;">#   (use &quot;git add &lt;file&gt;...&quot; to update what will be committed)</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#       modified:   .gitignore</span>
<span style="color: #666666; font-style: italic;">#</span>
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git add .gitignore
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git status
<span style="color: #666666; font-style: italic;"># On branch master</span>
<span style="color: #666666; font-style: italic;"># Changes to be committed:</span>
<span style="color: #666666; font-style: italic;">#   (use &quot;git reset HEAD &lt;file&gt;...&quot; to unstage)</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#       modified:   .gitignore</span>
<span style="color: #666666; font-style: italic;">#       deleted:    db/test.sqlite3</span>
<span style="color: #666666; font-style: italic;">#</span></pre></div></div>

<p>After running my tests my sqlite3 test db shows as modified.  Since my modification to .gitignore should be excluding all sqlite3 databases, it must already be in the git index.  So I removed it and added the updated .gitignore to the index.  I&#8217;m all ready for a commit.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git commit <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;resetting to post_9&quot;</span>
Created commit 79d6f46: resetting to post_9
 <span style="color: #000000;">2</span> files changed, <span style="color: #000000;">1</span> insertions<span style="color: #7a0874; font-weight: bold;">&#40;</span>+<span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">0</span> deletions<span style="color: #7a0874; font-weight: bold;">&#40;</span>-<span style="color: #7a0874; font-weight: bold;">&#41;</span>
 delete mode <span style="color: #000000;">100644</span> db<span style="color: #000000; font-weight: bold;">/</span>test.sqlite3
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git push github
git push github
Enter passphrase <span style="color: #000000; font-weight: bold;">for</span> key <span style="color: #ff0000;">'/home/rubyyot/.ssh/id_rsa'</span>:
To git<span style="color: #000000; font-weight: bold;">@</span>github.com:rubyyot<span style="color: #000000; font-weight: bold;">/</span>chores.git
 <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>rejected<span style="color: #7a0874; font-weight: bold;">&#93;</span>        master -<span style="color: #000000; font-weight: bold;">&gt;</span> master <span style="color: #7a0874; font-weight: bold;">&#40;</span>non-fast forward<span style="color: #7a0874; font-weight: bold;">&#41;</span>
error: failed to push some refs to <span style="color: #ff0000;">'git@github.com:rubyyot/chores.git'</span></pre></div></div>

<p>I make my commit and try to push to github.  The attempt is rejected.  Looks like I need to merge into it. </p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">rubyyot@atlas:~<span style="color:#006600; font-weight:bold;">/</span>working<span style="color:#006600; font-weight:bold;">/</span>chores$ git pull github master
Enter passphrase <span style="color:#9966CC; font-weight:bold;">for</span> key <span style="color:#996600;">'/home/rubyyot/.ssh/id_rsa'</span>:
From git@github.<span style="color:#9900CC;">com</span>:rubyyot<span style="color:#006600; font-weight:bold;">/</span>chores
 <span style="color:#006600; font-weight:bold;">*</span> branch            master     <span style="color:#006600; font-weight:bold;">-&gt;</span> FETCH_HEAD
Merge made by recursive.
 <span style="color:#9900CC;">README</span> <span style="color:#006600; font-weight:bold;">|</span>    <span style="color:#006666;">6</span> <span style="color:#006600; font-weight:bold;">++++++</span>
 <span style="color:#006666;">1</span> files changed, <span style="color:#006666;">6</span> insertions<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#006666;">0</span> deletions<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006600; font-weight:bold;">&#41;</span>
rubyyot@atlas:~<span style="color:#006600; font-weight:bold;">/</span>working<span style="color:#006600; font-weight:bold;">/</span>chores$ git merge ac60baa287c7ee73851d1b9895c7e6c826abddac
Already up<span style="color:#006600; font-weight:bold;">-</span>to<span style="color:#006600; font-weight:bold;">-</span>date.</pre></div></div>

<p>I pull from github which appears to auto-merge.  My manual attempt to merge tells me that I&#8217;m up to date.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ <span style="color: #c20cb9; font-weight: bold;">vi</span> README   <span style="color: #666666; font-style: italic;">#made a small change to README</span>
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git status
<span style="color: #666666; font-style: italic;"># On branch master</span>
<span style="color: #666666; font-style: italic;"># Your branch is ahead of 'origin/master' by 3 commits.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Changed but not updated:</span>
<span style="color: #666666; font-style: italic;">#   (use &quot;git add &lt;file&gt;...&quot; to update what will be committed)</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#       modified:   README</span>
<span style="color: #666666; font-style: italic;">#</span>
no changes added to commit <span style="color: #7a0874; font-weight: bold;">&#40;</span>use <span style="color: #ff0000;">&quot;git add&quot;</span> and<span style="color: #000000; font-weight: bold;">/</span>or <span style="color: #ff0000;">&quot;git commit -a&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git add .
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git commit <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;small change to try commit to github&quot;</span>
Created commit 9991b45: small change to try commit to github
 <span style="color: #000000;">1</span> files changed, <span style="color: #000000;">1</span> insertions<span style="color: #7a0874; font-weight: bold;">&#40;</span>+<span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">1</span> deletions<span style="color: #7a0874; font-weight: bold;">&#40;</span>-<span style="color: #7a0874; font-weight: bold;">&#41;</span>
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git push github
Enter passphrase <span style="color: #000000; font-weight: bold;">for</span> key <span style="color: #ff0000;">'/home/rubyyot/.ssh/id_rsa'</span>:
Counting objects: <span style="color: #000000;">15</span>, done.
Compressing objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">8</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
Writing objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">9</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">9</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">955</span> bytes, done.
Total <span style="color: #000000;">9</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">5</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, reused <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
To git<span style="color: #000000; font-weight: bold;">@</span>github.com:rubyyot<span style="color: #000000; font-weight: bold;">/</span>chores.git
   ac60baa..9991b45  master -<span style="color: #000000; font-weight: bold;">&gt;</span> master
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git status
<span style="color: #666666; font-style: italic;"># On branch master</span>
nothing to commit <span style="color: #7a0874; font-weight: bold;">&#40;</span>working directory clean<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p> I made a small change and attempted to commit to github.  It worked, yay!</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">rubyyot@atlas:~<span style="color:#006600; font-weight:bold;">/</span>working<span style="color:#006600; font-weight:bold;">/</span>chores$ vi README  <span style="color:#008000; font-style:italic;">#another small change to README</span>
rubyyot@atlas:~<span style="color:#006600; font-weight:bold;">/</span>working<span style="color:#006600; font-weight:bold;">/</span>chores$ git status
<span style="color:#008000; font-style:italic;"># On branch master</span>
<span style="color:#008000; font-style:italic;"># Changed but not updated:</span>
<span style="color:#008000; font-style:italic;">#   (use &quot;git add &lt;file&gt;...&quot; to update what will be committed)</span>
<span style="color:#008000; font-style:italic;">#</span>
<span style="color:#008000; font-style:italic;">#       modified:   README</span>
<span style="color:#008000; font-style:italic;">#</span>
no changes added to commit <span style="color:#006600; font-weight:bold;">&#40;</span>use <span style="color:#996600;">&quot;git add&quot;</span> <span style="color:#9966CC; font-weight:bold;">and</span><span style="color:#006600; font-weight:bold;">/</span><span style="color:#9966CC; font-weight:bold;">or</span> <span style="color:#996600;">&quot;git commit -a&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
rubyyot@atlas:~<span style="color:#006600; font-weight:bold;">/</span>working<span style="color:#006600; font-weight:bold;">/</span>chores$ git add .
<span style="color:#9900CC;">rubyyot</span>@atlas:~<span style="color:#006600; font-weight:bold;">/</span>working<span style="color:#006600; font-weight:bold;">/</span>chores$ git commit <span style="color:#006600; font-weight:bold;">-</span>m <span style="color:#996600;">&quot;another small commit to test new remote to github&quot;</span>
Created commit a5b8a72: another small commit to test new remote to github
 <span style="color:#006666;">1</span> files changed, <span style="color:#006666;">1</span> insertions<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#006666;">1</span> deletions<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006600; font-weight:bold;">&#41;</span>
rubyyot@atlas:~<span style="color:#006600; font-weight:bold;">/</span>working<span style="color:#006600; font-weight:bold;">/</span>chores$ git push origin
fatal: protocol error: expected sha<span style="color:#006600; font-weight:bold;">/</span>ref, got <span style="color:#996600;">'
*********'</span>
&nbsp;
You can<span style="color:#996600;">'t push to git://github.com/user/repo.git
Use git@github.com:user/repo.git
&nbsp;
*********'</span></pre></div></div>

<p>You will recall that earlier I removed my remote to my shared host and replaced it with github.  Here I tried to push another small commit to it and it failed.  I used my public clone url rather than my private ssh protected one, as I mentioned earlier.  Time to fix that.  </p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git remote <span style="color: #c20cb9; font-weight: bold;">rm</span> origin
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git remote add origin git<span style="color: #000000; font-weight: bold;">@</span>github.com:rubyyot<span style="color: #000000; font-weight: bold;">/</span>chores.git
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git status
<span style="color: #666666; font-style: italic;"># On branch master</span>
nothing to commit <span style="color: #7a0874; font-weight: bold;">&#40;</span>working directory clean<span style="color: #7a0874; font-weight: bold;">&#41;</span>
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git push origin
Enter passphrase <span style="color: #000000; font-weight: bold;">for</span> key <span style="color: #ff0000;">'/home/rubyyot/.ssh/id_rsa'</span>:
Counting objects: <span style="color: #000000;">5</span>, done.
Compressing objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">3</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">3</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
Writing objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">3</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">3</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">330</span> bytes, done.
Total <span style="color: #000000;">3</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, reused <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
To git<span style="color: #000000; font-weight: bold;">@</span>github.com:rubyyot<span style="color: #000000; font-weight: bold;">/</span>chores.git
   9991b45..a5b8a72  master -<span style="color: #000000; font-weight: bold;">&gt;</span> master
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$ git <span style="color: #c20cb9; font-weight: bold;">gc</span>
Counting objects: <span style="color: #000000;">352</span>, done.
Compressing objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">244</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">244</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
Writing objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">352</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">352</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
Total <span style="color: #000000;">352</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">105</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, reused <span style="color: #000000;">275</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">71</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores$</pre></div></div>

<p>All fixed up and I&#8217;m back in sync.  I am still new to git and am only familiar with the handful of commands I use on a daily basis.  There was probably a better or easier way to do what I did.  If so, feel free to comment.  If you are new to git too here are a couple resources.</p>
<ul>
<li><a href="http://www.kernel.org/pub/software/scm/git/docs/everyday.html" target="_blank">Everyday Git</a> </li>
<li><a href="http://www.lostechies.com/blogs/jason_meridth/archive/2009/06/01/git-for-windows-developers-git-series-part-1.aspx" target="_blank">Git for Windows on Los Techies</a></li>
</ul>
<h3>How do I?</h3>
<p>Below I included a small experiment I did where I cloned the chores source to a new local repository, checked out the post_9 tag to a new branch, modified origin to point to another repository, and checked the branch into master.  Hopefully it will give you something to work with if you want to do anything similar.  Alternatively, you could fork my github source into your own github repo and have fun.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">&nbsp;
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working$ git clone   git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>rubyyot<span style="color: #000000; font-weight: bold;">/</span>chores.git chores-github
Initialized empty Git repository <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>rubyyot<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores-github<span style="color: #000000; font-weight: bold;">/</span>.git<span style="color: #000000; font-weight: bold;">/</span>
remote: Counting objects: <span style="color: #000000;">352</span>, done.
remote: Compressing objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">227</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">227</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
remote: Total <span style="color: #000000;">352</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">105</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, reused <span style="color: #000000;">320</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">88</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Receiving objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">352</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">352</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">139.50</span> KiB, done.
Resolving deltas: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">105</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">105</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working$ <span style="color: #7a0874; font-weight: bold;">cd</span> chores-github<span style="color: #000000; font-weight: bold;">/</span>
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores-github$ git branch post_9_branch post_9
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores-github$ git checkout post_9_branch
Switched to branch <span style="color: #ff0000;">&quot;post_9_branch&quot;</span>
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores-github$
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores-github$ git remote <span style="color: #c20cb9; font-weight: bold;">rm</span> origin
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores-github$ git remote add origin <span style="color: #c20cb9; font-weight: bold;">ssh</span>:<span style="color: #000000; font-weight: bold;">//</span>USERNAME<span style="color: #000000; font-weight: bold;">@</span>example.com<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>repo
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores-github$ git pull origin master
USERNAME<span style="color: #000000; font-weight: bold;">@</span>example.coms password:
From <span style="color: #c20cb9; font-weight: bold;">ssh</span>:<span style="color: #000000; font-weight: bold;">//</span>USERNAME<span style="color: #000000; font-weight: bold;">@</span>example.com<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>repo
 <span style="color: #000000; font-weight: bold;">*</span> branch            master     -<span style="color: #000000; font-weight: bold;">&gt;</span> FETCH_HEAD
Already up-to-date.
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores-github$ git status
<span style="color: #666666; font-style: italic;"># On branch post_9_branch</span>
nothing to commit <span style="color: #7a0874; font-weight: bold;">&#40;</span>working directory clean<span style="color: #7a0874; font-weight: bold;">&#41;</span>
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores-github$ git checkout master
Switched to branch <span style="color: #ff0000;">&quot;master&quot;</span>
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores-github$ git merge post_9_branch
Already up-to-date.
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores-github$ git status
<span style="color: #666666; font-style: italic;"># On branch master</span>
nothing to commit <span style="color: #7a0874; font-weight: bold;">&#40;</span>working directory clean<span style="color: #7a0874; font-weight: bold;">&#41;</span>
rubyyot<span style="color: #000000; font-weight: bold;">@</span>atlas:~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores-github$</pre></div></div>

<h3>Conclusion</h3>
<p>In all it seems that things were not as bad as I had originally thought.  Still it reinforces the need for discipline in doing TDD and coding in general.  In the next post I will look over the health of the app and (hopefully) take appropriate steps to correct any problems. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rubyyot.com/2009/06/chores-a-test-driven-website-part-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Plans for Rubyyot.com and the Summer of Learning Challenge</title>
		<link>http://blog.rubyyot.com/2009/05/summer-of-learning-challenge/</link>
		<comments>http://blog.rubyyot.com/2009/05/summer-of-learning-challenge/#comments</comments>
		<pubDate>Sun, 24 May 2009 18:17:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Thoughts]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[rack]]></category>
		<category><![CDATA[rubyyot]]></category>
		<category><![CDATA[self-improvement]]></category>
		<category><![CDATA[summer of learning challenge]]></category>

		<guid isPermaLink="false">http://blog.rubyyot.com/?p=560</guid>
		<description><![CDATA[Plans for the future
In the past week I started playing with Rack and put together a little Rack application that generates content from my blog&#8217;s rss feed about the site.   As I stated in that post I really didn&#8217;t like having the &#8220;parked&#8221; page up there, and I also wanted to try out Rack, which [...]]]></description>
			<content:encoded><![CDATA[<h2>Plans for the future</h2>
<p>In the past week I started playing with Rack and put together a little Rack <a title="Using Rack to generate content from an rss feed" href="http://blog.rubyyot.com/2009/05/using-rack-to-generate-content-from-an-rss-feed/" target="_blank">application that generates content from my blog&#8217;s rss feed about the site</a>.   As I stated in that post I really didn&#8217;t like having the &#8220;parked&#8221; page up there, and I also wanted to try out Rack, which has gotten so much press of late.   I was very impressed with Rack, and how easy it was to put together a simple web application with it.</p>
<p>Until that point, I had used Rails, used non-Ruby web frameworks and used Ruby for other non web-based projects, but I had not created a Ruby based web application with anything other than Rails.  It was an enlightening experience.   It got me thinking about Rails, what it provides out of the box:</p>
<ul>
<li><a title="ActiveRecord" href="http://ar.rubyonrails.org/" target="_blank">ActiveRecord</a> for persistent, vendor agnostic storage and model building goodness</li>
<li>Built in support for <a title="AJAX on Rails" href="http://railsonedge.blogspot.com/2008/03/tutorial-beginning-ajax-with-rails-20.html" target="_blank">AJAX</a> and <a title="Partial views" href="http://addictedtonew.com/archives/149/a-bit-on-rails-partials/" target="_blank">partial views</a>.</li>
<li>Controllers to coordinate between them</li>
<li>Simple support for <a title="Restful Rails" href="http://www.sitepoint.com/blogs/2008/02/04/restful-rails-part-i/" target="_blank">REST</a> web services</li>
<li><a title="ActionMailer" href="http://wiki.rubyonrails.org/rails/pages/HowToSendEmailsWithActionMailer" target="_blank">ActionMailer</a> for email handling</li>
<li>Flexible <a title="Routing" href="http://api.rubyonrails.org/classes/ActionController/Routing.html" target="_blank">url routing</a></li>
<li>An active and growing community that provides a large number of useful and often cutting edge add-ons and <a title="Guides" href="http://guides.rubyonrails.org/" target="_blank">guides</a>.</li>
</ul>
<p>Additionally, many of these features are modular and can be swapped out or replaced with other modules to suit your tastes.  That is quite an impressive and list, and by no means comprehensive.  With Rails 3 on the horizon, there are even more great things on the way.   It&#8217;s no wonder, that I fell in love with Rails.</p>
<p>However, I realized that a number of things I use to develop Rails applications are not truly Rails features, but only supported by Rails.  This by no means a slight against Rails, but it is something great about Ruby and the Ruby community.   Here are some features and libraries that I make use of:</p>
<ul>
<li><a title="erb" href="http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html" target="_blank">erb</a> &#8211; Templating engine available in ruby itself.</li>
<li><a title="Rake" href="http://rake.rubyforge.org/" target="_blank">rake</a> &#8211; An essential make utility for automating reoccurring tasks.</li>
<li><a title="Test::Unit" href="http://www.ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.html" target="_blank">Test::Unit</a> &#8211; Unit testing framework, baked into Ruby.</li>
<li><a title="Cucumber" href="http://cukes.info/" target="_blank">Cucumber</a>, <a title="RSpec intro" href="http://blog.davidchelimsky.net/2007/05/14/an-introduction-to-rspec-part-i/" target="_blank">RSpec</a> and friends &#8211; There are group of great libraries available for testing Rails and other Ruby apps.</li>
<li><a title="git" href="http://git-scm.com/" target="_blank">git</a> and <a title="Github" href="http://github.com/" target="_blank">github</a> &#8211; Fast, distributed source control and repository hosting.</li>
<li><a title="Rack" href="http://rack.rubyforge.org/" target="_blank">Rack</a> &#8211; The new hotness in standardized web server interfaces.</li>
<li><a title="Capistrano" href="http://www.capify.org/" target="_blank">Capistrano</a> &#8211; Automated deployment.</li>
<li><a title="Phusion Passenger - aka mod_rails" href="http://www.modrails.com/" target="_blank">Phusion Passenger</a> &#8211; Once called mod_rails, it is actually more than that, as it supports all Rack based applications.</li>
<li><strong>Dedication to best practices and self-improvement</strong> &#8211; While not technically a feature, it is ingrained in the Ruby and Rails communities and it&#8217;s contagious.</li>
</ul>
<p>Chances are, if you have done any Rails development you have encountered, used and enjoyed some or all of these.   My point here is not to say that Rails is only great because Ruby is great.  Rather that while Rails is awesome, there is a strong and viable codebase for building applications, web-based or otherwise, in the greater Ruby community.  The relationship between Rails and Ruby and the popularity of Rails as a framework have made both better and stronger tools.</p>
<h2>Building Cohesive Applications</h2>
<p>This relationship would not be as be strong, if Rails was<a title="Rails Myth -  Rails is a monolith" href="http://www.loudthinking.com/posts/33-myth-4-rails-is-a-monolith" target="_blank"> built as  a monolith</a>.  Instead, Rails is designed in to be modular.  The framework itself is broken up into no less than 6 gems:</p>
<pre>rubyyot@atlas:~$ jruby -S gem install rails
Successfully installed activesupport-2.3.2
Successfully installed activerecord-2.3.2
Successfully installed actionpack-2.3.2
Successfully installed actionmailer-2.3.2
Successfully installed activeresource-2.3.2
Successfully installed rails-2.3.2
6 gems installed</pre>
<p>Within that, as we saw, the standard way of building rails uses a number of other tools and libraries.  These parts are generally built to be <a title="Cohesion vs. Coupling" href="http://www.hokstad.com/why-coupling-is-always-bad-cohesion-vs-coupling.html" target="_blank">highly cohesive rather than highly coupled</a>.  This property of good design is probably best described by Uncle Bob&#8217;s <a title="S.O.L.I.D." href="http://www.lostechies.com/blogs/chad_myers/archive/2008/03/07/pablo-s-topic-of-the-month-march-solid-principles.aspx" target="_blank">SOLID principles</a>.  These are:</p>
<ul>
<li><strong><a href="http://www.objectmentor.com/resources/articles/srp.pdf">Single Responsibility Principle</a></strong>
<ul>
<li>There should never be more than one reason for a class to change</li>
</ul>
</li>
<li><strong><a href="http://www.objectmentor.com/resources/articles/ocp.pdf">Open Closed Principle</a></strong>
<ul>
<li> Software entities (classes, modules, functions, etc.) should be open for extention but closed for modification.</li>
</ul>
</li>
<li> <strong><a href="http://www.objectmentor.com/resources/articles/lsp.pdf">Liskov Substitution Principle</a></strong>
<ul>
<li>Functions that use &#8230; references to base classes must be able to use objects of derived classes without knowing it.</li>
</ul>
</li>
<li> <strong><a href="http://www.objectmentor.com/resources/articles/isp.pdf">Interface Segregation Principle</a></strong>
<ul>
<li>Clients should not be forced to depend upon interfaces that they do not use.</li>
</ul>
</li>
<li> <strong><a href="http://www.objectmentor.com/resources/articles/dip.pdf">Dependency Inversion Principle</a></strong>
<ul>
<li>High level modules should not depend on low level modules. Both should depend on abstractions.</li>
<li>Abstractions should not depend on details. Details should depend upon abstractions.</li>
</ul>
</li>
</ul>
<p>While these principles were written with less dynamic languages than Ruby in mind, such as Java and C#.  Understanding them and applying them  in any language will help you to write clean code.  Code with minimal dependencies that strangle it&#8217;s agility and make make maintenance a nightmare.  These SOLID principles also make code more modular and enable the long promised re-usability that all object-oriented programmers learn about in OO101.</p>
<h2>Ruby Web Frameworks</h2>
<p>One of the trends in the Ruby and Rails communities in the past year or two, has been the building of other web frameworks.  These were often termed micro-frameworks because they offered the ability to build ruby based web applications without having to run a full Rails stack.  The most notable of these are <a title="Merb" href="http://merbivore.com/" target="_blank">Merb</a> and <a title="Sinatra" href="http://www.sinatrarb.com/" target="_blank">Sinatra</a>.  While these began to splinter ruby based web development, my mantra for this year is:</p>
<blockquote><p>Change is good.</p></blockquote>
<p>These project went and approached the building of web applications in Ruby in different ways.  In doing so they opened up the doors to creativity and brought some improvements and  fresh ideas to the table.  The benefits of this are even now coming clear with the announcement that <a title="Merb to be merged into Rails 3" href="http://weblog.rubyonrails.org/2008/12/23/merb-gets-merged-into-rails-3" target="_blank">Merb will be merged into Rails 3</a>.  This promises to bring <a title="Rails 3 in Action" href="http://www.manning.com/katz/" target="_blank">more speed and modularity</a> to the Rails framework.</p>
<h2>Pragmatic Thinking and Learning</h2>
<p>I recently completed the book <a title="Pragmatic Thinking and Learning" href="http://www.pragprog.com/titles/ahptl/pragmatic-thinking-and-learning" target="_blank">Pragmatic Thinking and Learning</a>.  It was an excellent book that centers around bringing our innate creativity (<em>R</em>-mode) to the party to achieve goals and solve problems.  While it&#8217;s a book targeted to technical people it is not written for one specific language or even just for programmers.  It takes a number of interesting studies and theories, most notable for me is Betty Edwards&#8217; <a title="Drawing on the Right Side of the Brain" href="http://www.drawright.com/" target="_blank">Drawing on the Right Side of the Brain</a> and brings them together into a series of tips and hueristics for improving your thought processes.  It&#8217;s a very interesting book and I would recommend it to anyone interested in the topic.</p>
<h2>Rails and Lettuce</h2>
<p>In of the book, Andy Hunt is discussing personal wikis and shows a page from his WikiNotes (figure 8.3 ).  It shows a series of thoughts as follows:</p>
<blockquote>
<ul>
<li>U.S. per capita consumption of Romaine lettuce increased 162%</li>
<li>Lettuce consumption at a record High</li>
<li>Convenience of pre-washed, bagged lettuce outweighs cost.</li>
<li>MORAL: it&#8217;s got to be easy</li>
</ul>
</blockquote>
<p>I thought that this was a particularly interesting observation and in a way is a metaphor for Rails.</p>
<p>The sales of Romaine lettuce increased 162% by pre-washing and packaging it in convenient bags.   This packaging is widely popular in spite of the increased cost.  It&#8217;s clear that lettuce is a great product.  Everyone knows it&#8217;s healthy and it&#8217;s the building block of salads and great in sandwiches as well.  Still it&#8217;s popularity were greatly improved by giving it an instant, right out of the box, interface.   Similarly Ruby web frameworks are great products.  Rails packages that goodness up in an easy to learn, build and deploy.</p>
<h2>Reinventing the Wheel vs. Digging a Rut</h2>
<p><a title="Rack @ RailsGuides" href="http://rack.rubyforge.org/" target="_blank">Rails</a> is built on top of Rack.  Rack is written in <a title="Ruby" href="http://www.ruby-lang.org/en/" target="_blank">Ruby </a>and specifies the interface between the web server and the Rails framework.  In fact Merb and Sinatra are built on top of Rack as well.  Still, as we saw, Rack is available for building upon directly and of course Ruby and it&#8217;s libraries are available as well.  So why not build a Ruby web application without any framework at all?  Well the obvious answer is that you won&#8217;t have all of the nice things that these web frameworks provide.  Not to mention many of these pieces have now been used and tested by production applications for years now.  It may be a better question to ask:</p>
<blockquote><p>Why wouldn&#8217;t I want to use one of the pre-built frameworks?</p></blockquote>
<p>The answer to that question is what has been forming in my mind since I tried out Rack for the first time.</p>
<ul>
<li><strong>Frameworks remove options -</strong> Even the best framework on the planet is going to take away options.  Lean Methodologies include the idea of <a title="Delay decisions as long possible" href="http://en.wikipedia.org/wiki/Lean_software_development#Decide_as_late_as_possible" target="_blank">delaying decisions as long as possible</a> allowing for greater flexability later on.   Many times we want to use a framework, because it leave a clear path to a production ready application.  This comes at the cost of options and I don&#8217;t want these removed.</li>
<li><strong>Learning Opportunity</strong> -  Often the best way to learn something is to do it.  I&#8217;m not an expert with Rails, I still have more to learn, but I also want to learn more about writing and designing applications for the web in general.  Therefore it makes sense to bypass the framework and hook directly into Rack.</li>
<li><strong>Many libraries are still available</strong> &#8211; As we saw before, many of the tools used in the creation of Rails applications are still available for use.</li>
<li><strong>Completely Custom</strong> &#8211; I used to love watching shows like <a title="American Chopper" href="http://tlc.discovery.com/tv/american-chopper/american-chopper.html" target="_blank">American Chopper</a> and <a title="Monster Garage " href="http://en.wikipedia.org/wiki/Monster_Garage" target="_blank">Monster Garage</a> even though I know next to nothing about building a car or a bike.  The thrill was in watching highly skilled people create baddass and functional custom vehicles.  This is a similar though admittedly geekier endeavor.</li>
<li><a title="Beginner's Mind" href="http://www.ironpalm.com/beginner.html" target="_blank"><strong>Beginner&#8217;s Mind</strong></a> &#8211; This zen concept urges you to remove look at things without filtering them through your pre-conceived ideas and biases to gain greater understanding.  Approaching this project without relying on a pre-conceived framework should lead to similar results.</li>
</ul>
<p>All of these are great reasons for me to try making my own path and not generating yet another Rails application.  That&#8217;s not to say that Rails isn&#8217;t great, or I&#8217;m better than Rails.  It&#8217;s just not the right fit, right now for my project.  In the end I&#8217;d rather re-invent the wheel than dig myself into a rut.</p>
<h2>Vaporware and Playing to Learn</h2>
<p>One thing that I do when working with my personal projects is that I will have an idea and start to run with it.  After a while of working with the idea, more ideas will come and my attention will turn away from my original project and move on to other things.  Some examples of this are:</p>
<ul>
<li><a title="Resolvr" href="http://github.com/rubyyot/resolvr/tree" target="_blank">Resolvr</a> &#8211; A dependency injection mechanism for Ruby.</li>
<li><a title="Gippr" href="http://github.com/rubyyot/gippr/tree" target="_blank">Gippr</a> &#8211; A library for parsing the GIFT file format.</li>
<li><a title="RSimpy" href="http://github.com/rubyyot/rsimpy/tree" target="_blank">RSimpy</a> &#8211; A wrapper for the API to <a title="Simpy" href="http://Simpy.com" target="_blank">Simpy.com<br />
</a></li>
</ul>
<p>Will I ever get back to these and complete them?  Maybe.  Much of what I do in my personal projects is playing to learn.  Like when I was a kid and I wanted to build a giant working  robot or transformer out of legos.  Did I ever finish these projects?  No, but they were fun and I learned a number of interesting things along the way.  This is one of the great things about personal projects.  There is no one expecting you to deliver a product, so you are free to persue whatever interests you.  Even if that means that you abandon the project altogether and move on to another.</p>
<p>There is a character on the show Jimmy Neutron, that my kids watch,  called <a title="Professor Calamitous" href="http://jimmyneutron.wikia.com/wiki/Professor_Calamitous" target="_blank">Professor Calamitous</a>. He is a brilliant scientist bent on doing evil.  However, he is continually undone by his character flaw, that is that he can never finish anything.  I have often teased my wife, because she will get very excited about a project and work on it.  She won&#8217;t just do a little, but she really digs into it and attacks the subject.  After some time she will, almost overnight, lose interest and move on to something else.  I&#8217;ll tell her that her inner Professor Calamitous has struck.  In actuality, I&#8217;m just as guilty of it as she is if not more so (sorry for teasing you).</p>
<p>When viewed from a goals oriented perspective this is a horrible waste of time.  Why put all the energy into something that will be left to rot, unfinished?  From another perspective, that of a learning tool, it is a great accomplishment and a goal achieved.  The time wasn&#8217;t wasted because in doing something with the project, rather than just reading (or writing, speaking, etc.) about the topic, you develop hands on experience and engage much more of your mind (<em>R</em>-mode) than you would have otherwise.</p>
<h2>Personal Wiki</h2>
<p>Now I feel it&#8217;s my duty to bring all of these random thoughts together and issue a challenge to any out there who might be reading this.   The book, Pragmatic Thinking and Learning, recommends the use of a personal wiki to gather together your thoughts and organize them into an <a title="Exocortex" href="http://en.wikipedia.org/wiki/Exocortex" target="_blank">exocortex</a>.  I looked through all of the available wiki software out there and none of them really felt right.  That was a kind of personal decision and it&#8217;s nothing against any of the software available.  They either didn&#8217;t provide the features I wanted, or I didn&#8217;t like the look and feel.</p>
<h2>Requirements</h2>
<ul>
<li><strong>Good feel</strong> &#8211; If I&#8217;m going to do this, I will be spending a significant amount of time with it.  Any tool I will be spending that much time with, better not have annoyances, no matter how small.</li>
<li><strong>High Availability</strong> &#8211; While it may not need to be as available as a <a title="Ubiquitous Collection Tool" href="http://davecaolo.com/productivity/ubiquitous-capture-tool/" target="_blank">ubiquitous collection tool</a>, it should be available to me at work and at home, at the very least.</li>
<li><strong>Wiki Formatting </strong>- Whether via wiki markup, RedCloth or some other means it should be easy to build and grow as a wiki.  That&#8217;s kinda the point of a Personal Wiki</li>
<li><strong>Single user editing</strong> -  It may seem odd to have a wiki that is editable by a single person, but if it&#8217;s just for me, then it only makes sense.</li>
<li><strong>Public display</strong> &#8211; Some of the things I put in it would make sense to be available to others who are interested.</li>
<li><strong>Private display</strong> &#8211; Some of the things in it may be private and kept that way.</li>
<li><strong>Easy backup and recovery</strong> &#8211; If I&#8217;m going to go to all the trouble of writing and gardening a wiki, it should be safe and recoverable in the event of corruption, disaster or my own foolishness.</li>
<li><strong>Customizable</strong> &#8211; I may want to have dynamic content on some pages.  Perhaps it should pull in my bookmarks on a topic and display them with other content.</li>
</ul>
<p>That is quite a hefty list and I&#8217;m sure that there will be other things along the way that I&#8217;ll want to put in there.  It&#8217;s no wonder I couldn&#8217;t find what I wanted out of the box.</p>
<p>I&#8217;ve decided to build this directly on Rack, using git, github and other useful tools I would use in building a Rails app.  I&#8217;m not sure how this will go at this point, but it&#8217;s an exciting project and I hope to have something to show for it by the end of summer.</p>
<h2>The Summer of Learning Challenge</h2>
<p>We all have these kinds of ideas floating around in our heads, and the more creative ideas we listen to and act upon, the more will come to us.   I think that right now is a great time, as it is the beginning of Summer 2009 to act on one, or more, of these.  The summer provides a set time frame that is long enough to make something great, but short enough that we won&#8217;t put it off forever.  I think that it would be great to see others (you) find a project they are interested in a make a commitment to work on it this summer.  If you are a developer/programmer, make your project open-source.  It could be a great benefit to others.  It will defiantly be a great experience for you.</p>
<p>A few years ago I took part in and completed <a title="National Novel Writing Month" href="http://www.nanowrimo.org/" target="_blank">NaNoWriMo</a>.  My book wasn&#8217;t finished at the end, but I wrote 50,000 words of it in one month.  That was a great accomplishment for me, something that I didn&#8217;t think I could do when I started.  By setting the goal and working toward it I was able to complete it.  It felt great.  What could you do if you set your mind to it?</p>
<h2>What Will You Do?</h2>
<p>If you are interested in taking the challenge or just have an idea or a comment about mine.  Please leave feedback or blog about it yourself an leave a postback.  It&#8217;s going to be a great summer.  Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rubyyot.com/2009/05/summer-of-learning-challenge/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Chores: a test driven website &#8211; Part 9 (the lost episode)</title>
		<link>http://blog.rubyyot.com/2009/05/chores-a-test-driven-website-part-9-the-lost-episode/</link>
		<comments>http://blog.rubyyot.com/2009/05/chores-a-test-driven-website-part-9-the-lost-episode/#comments</comments>
		<pubDate>Sun, 10 May 2009 13:00:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Chores]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://blog.rubyyot.com/?p=290</guid>
		<description><![CDATA[This is part of the Chores series of posts.
Well it&#8217;s been a while since National Testing month and there has been a lot going on both in my world and in the Ruby Community.  I&#8217;ve been doing a good deal of reading, deployed a Monorail website and been generally busy.  Unfortunately, I haven&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>This is part of the <a href="http://blog.rubyyot.com/chores-a-test-driven-website/ ">Chores series of posts</a>.</p>
<p>Well it&#8217;s been a while since National Testing month and there has been a lot going on both in my world and in the Ruby Community.  I&#8217;ve been doing a good deal of reading, deployed a Monorail website and been generally busy.  Unfortunately, I haven&#8217;t focused on building Chores, my test driven chore delivering website.</p>
<p>Today I&#8217;ve changed all that by dusting off chores and updating my gems.  The first thing that I noticed was that I needed to add some configuration for Webrat for it to function within Cucumber.  I needed to add the following to the env.rb file:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">Webrat.<span style="color:#9900CC;">configure</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>config<span style="color:#006600; font-weight:bold;">|</span>
  config.<span style="color:#9900CC;">mode</span> = <span style="color:#ff3333; font-weight:bold;">:rails</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Next I see that I&#8217;m getting an error on the new action for Children because the @child variable is nil.  Let&#8217;s write a functional test to fix that.</p>
<p>Here is my first pass at the functional test and controller</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
</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;">'test_helper'</span>
<span style="color:#9966CC; font-weight:bold;">class</span> ChildrenCanCrud <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActionController::TestCase</span>
  tests ChildrenController
&nbsp;
  specify <span style="color:#996600;">&quot;test that it should respond to index&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    get <span style="color:#ff3333; font-weight:bold;">:index</span>
    assert_response <span style="color:#ff3333; font-weight:bold;">:success</span>
    assert_not_nil assigns<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:children</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  specify <span style="color:#996600;">&quot;that it should pass child on new&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    get <span style="color:#ff3333; font-weight:bold;">:new</span>
    assert_response <span style="color:#ff3333; font-weight:bold;">:success</span>
    assert_not_nil assigns<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:child</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  specify <span style="color:#996600;">&quot;that it should create child&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    assert_difference <span style="color:#996600;">'Child.count'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      post <span style="color:#ff3333; font-weight:bold;">:create</span>, <span style="color:#ff3333; font-weight:bold;">:child</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;">:parent</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> Identity.<span style="color:#9900CC;">make</span>, <span style="color:#ff3333; font-weight:bold;">:identity</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> Identity.<span style="color:#9900CC;">make</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    assert_redirected_to children_url
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>./app/models/child.rb</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
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Child <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
  attr_accessor <span style="color:#ff3333; font-weight:bold;">:open_identifier</span>
  before_create <span style="color:#ff3333; font-weight:bold;">:set_identity</span>
&nbsp;
  belongs_to <span style="color:#ff3333; font-weight:bold;">:identity</span>,             <span style="color:#ff3333; font-weight:bold;">:foreign_key</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:child_id</span>,
                                    <span style="color:#ff3333; font-weight:bold;">:class_name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Identity'</span>
&nbsp;
  belongs_to <span style="color:#ff3333; font-weight:bold;">:parent</span>,               <span style="color:#ff3333; font-weight:bold;">:foreign_key</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:parent_id</span>,
                                    <span style="color:#ff3333; font-weight:bold;">:class_name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Identity'</span>
&nbsp;
  validates_presence_of <span style="color:#ff3333; font-weight:bold;">:open_identifier</span>,  <span style="color:#ff3333; font-weight:bold;">:message</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'can not be blank.'</span>,
                                           <span style="color:#ff3333; font-weight:bold;">:on</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:create</span>
  validates_presence_of <span style="color:#ff3333; font-weight:bold;">:identity</span>,         <span style="color:#ff3333; font-weight:bold;">:message</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'can not be blank.'</span>,
                                           <span style="color:#ff3333; font-weight:bold;">:on</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:update</span>
  validates_presence_of <span style="color:#ff3333; font-weight:bold;">:parent</span>,    <span style="color:#ff3333; font-weight:bold;">:message</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'can not be blank.'</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> set_identity
    <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">identity</span> = Identity.<span style="color:#9900CC;">find_or_make_if_valid</span> <span style="color:#0066ff; font-weight:bold;">@open_identifier</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>./app/models/identity.rb</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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Identity <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
  <span style="color:#9966CC; font-weight:bold;">include</span> OpenIdAuthentication
&nbsp;
  validates_presence_of <span style="color:#ff3333; font-weight:bold;">:identifier</span>,        <span style="color:#ff3333; font-weight:bold;">:message</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;can not be blank.&quot;</span>
&nbsp;
  validates_uniqueness_of <span style="color:#ff3333; font-weight:bold;">:identifier</span>,      <span style="color:#ff3333; font-weight:bold;">:message</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;is already in use, please use another.&quot;</span>
&nbsp;
  validates_length_of <span style="color:#ff3333; font-weight:bold;">:identifier</span>,          <span style="color:#ff3333; font-weight:bold;">:maximum</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">100</span>,
                                            <span style="color:#ff3333; font-weight:bold;">:allow_nil</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span>,
                                            <span style="color:#ff3333; font-weight:bold;">:message</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;is too long.&quot;</span>
&nbsp;
  validate_on_create <span style="color:#ff3333; font-weight:bold;">:valid_id</span>
&nbsp;
  has_many <span style="color:#ff3333; font-weight:bold;">:parents</span>,             <span style="color:#ff3333; font-weight:bold;">:foreign_key</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:parent_id</span>,
                                 <span style="color:#ff3333; font-weight:bold;">:class_name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Child'</span>
  has_many <span style="color:#ff3333; font-weight:bold;">:children</span>,            <span style="color:#ff3333; font-weight:bold;">:foreign_key</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:child_id</span>,
                                 <span style="color:#ff3333; font-weight:bold;">:class_name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Child'</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> open_id
    <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#0000FF; font-weight:bold;">nil</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">identifier</span>.<span style="color:#0000FF; font-weight:bold;">nil</span>?
    <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">identifier</span><span style="color:#006600; font-weight:bold;">&#91;</span>7..<span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#93;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> identifier= identifier
    <span style="color:#CC0066; font-weight:bold;">raise</span> <span style="color:#996600;">&quot;Cannot update identifier.&quot;</span> <span style="color:#9966CC; font-weight:bold;">unless</span> new_record?
    set_identifier identifier
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> open_id= open_id
    <span style="color:#CC0066; font-weight:bold;">raise</span> <span style="color:#996600;">&quot;Cannot update open_id.&quot;</span> <span style="color:#9966CC; font-weight:bold;">unless</span> new_record?
    set_identifier open_id
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> valid_id
    errors.<span style="color:#9900CC;">add</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:identifier</span>, <span style="color:#996600;">&quot;is not a valid Open ID.&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0066ff; font-weight:bold;">@invalid_id</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">find_by_open_id</span> open_id
    id = OpenIdAuthentication::normalize_identifier<span style="color:#006600; font-weight:bold;">&#40;</span>open_id<span style="color:#006600; font-weight:bold;">&#41;</span>
    find_by_identifier open_id
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">find_or_make_if_valid</span> open_id
    <span style="color:#9966CC; font-weight:bold;">begin</span>
      id = <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">find_by_open_id</span> Identity.<span style="color:#9900CC;">normalize_identifier</span><span style="color:#006600; font-weight:bold;">&#40;</span>open_id<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">rescue</span> <span style="color:#6666ff; font-weight:bold;">OpenIdAuthentication::InvalidOpenId</span>
      <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#0000FF; font-weight:bold;">nil</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">unless</span> id
      id = Identity.<span style="color:#9900CC;">new</span> <span style="color:#ff3333; font-weight:bold;">:identifier</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> open_id
      id.<span style="color:#9900CC;">save</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
    id
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">def</span> Identity.<span style="color:#9900CC;">normalize_identifier</span> id
    <span style="color:#9966CC; font-weight:bold;">begin</span>
      identifier = OpenIdAuthentication::normalize_identifier<span style="color:#006600; font-weight:bold;">&#40;</span>id<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">rescue</span> <span style="color:#6666ff; font-weight:bold;">OpenIdAuthentication::InvalidOpenId</span>
      identifier = <span style="color:#0000FF; font-weight:bold;">nil</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
    identifier
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  protected
  <span style="color:#9966CC; font-weight:bold;">def</span> normalize_id id
    identifier = Identity.<span style="color:#9900CC;">normalize_identifier</span> id
    <span style="color:#9966CC; font-weight:bold;">unless</span> identifier
      <span style="color:#0066ff; font-weight:bold;">@invalid_id</span> = <span style="color:#0000FF; font-weight:bold;">true</span>
      identifier = id
    <span style="color:#9966CC; font-weight:bold;">end</span>
    identifier
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> set_identifier id
    write_attribute<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:identifier</span>, normalize_id<span style="color:#006600; font-weight:bold;">&#40;</span>id<span style="color:#006600; font-weight:bold;">&#41;</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>and</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
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> ChildrenController <span style="color:#006600; font-weight:bold;">&lt;</span> ApplicationController
  <span style="color:#9966CC; font-weight:bold;">def</span> index
    <span style="color:#0066ff; font-weight:bold;">@children</span> = Child.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:all</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> new
    <span style="color:#0066ff; font-weight:bold;">@child</span> = Child.<span style="color:#9900CC;">new</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> create
    <span style="color:#0066ff; font-weight:bold;">@child</span> = Child.<span style="color:#9900CC;">new</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;">:child</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;">if</span> <span style="color:#0066ff; font-weight:bold;">@child</span>.<span style="color:#9900CC;">save</span>
      flash<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:message</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#996600;">&quot;Child added.&quot;</span>
      redirect_to children_url
    <span style="color:#9966CC; font-weight:bold;">else</span>
      flash<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:error</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#996600;">&quot;Error saving Child.&quot;</span>
      render <span style="color:#ff3333; font-weight:bold;">:action</span> <span style="color:#006600; font-weight:bold;">=&gt;</span>  <span style="color:#996600;">&quot;new&quot;</span>
    <span style="color:#9966CC; font-weight:bold;">end</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>update to ./test/unit/child_test.rb</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
27
28
29
30
31
32
33
34
35
36
37
38
</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;">'test_helper'</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> ChildShouldBeValidated <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveSupport::TestCase</span>
&nbsp;
  specify <span style="color:#996600;">&quot;that a parent is required&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    child = Child.<span style="color:#9900CC;">new</span>
    child.<span style="color:#9900CC;">open_identifier</span> = valid_open_id
    invalid child
    child.<span style="color:#9900CC;">parent</span> = Identity.<span style="color:#9900CC;">make</span>
    valid child
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  specify <span style="color:#996600;">&quot;that a child is required&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    child = Child.<span style="color:#9900CC;">new</span> <span style="color:#ff3333; font-weight:bold;">:parent</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> Identity.<span style="color:#9900CC;">make</span>
    invalid child
    child.<span style="color:#9900CC;">open_identifier</span> = valid_open_id
    valid child
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  specify <span style="color:#996600;">&quot;message for a null identity&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    child = Child.<span style="color:#9900CC;">new</span> <span style="color:#ff3333; font-weight:bold;">:parent</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> Identity.<span style="color:#9900CC;">make</span>
    validation_message_for child, <span style="color:#ff3333; font-weight:bold;">:open_identifier</span>, <span style="color:#996600;">&quot;can not be blank.&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  specify <span style="color:#996600;">&quot;message for a null parent&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    child = Child.<span style="color:#9900CC;">new</span> <span style="color:#ff3333; font-weight:bold;">:identity</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> Identity.<span style="color:#9900CC;">make</span>
    validation_message_for child, <span style="color:#ff3333; font-weight:bold;">:parent</span>, <span style="color:#996600;">&quot;can not be blank.&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;">class</span> ChildShouldCreateIdentity <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveSupport::TestCase</span>
&nbsp;
  specify <span style="color:#996600;">&quot;that open_identifier is used to pass the OpenId&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    child = Child.<span style="color:#9900CC;">new</span> <span style="color:#ff3333; font-weight:bold;">:parent</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> Identity.<span style="color:#9900CC;">make</span>
    child.<span style="color:#9900CC;">open_identifier</span> = valid_open_id
    assert child.<span style="color:#9900CC;">save</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>./test/functional/children_controller_test.rb</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
27
28
29
30
</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;">'test_helper'</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> ChildrenCanCrud <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActionController::TestCase</span>
  tests ChildrenController
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> setup
    <span style="color:#0066ff; font-weight:bold;">@identity</span> = Identity.<span style="color:#9900CC;">make</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  specify <span style="color:#996600;">&quot;test that it should respond to index&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    get <span style="color:#ff3333; font-weight:bold;">:index</span>, <span style="color:#0000FF; font-weight:bold;">nil</span>, build_session_hash_for<span style="color:#006600; font-weight:bold;">&#40;</span>@identity<span style="color:#006600; font-weight:bold;">&#41;</span>
    assert_response <span style="color:#ff3333; font-weight:bold;">:success</span>
    assert_not_nil assigns<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:children</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  specify <span style="color:#996600;">&quot;that it should pass child on new&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    get <span style="color:#ff3333; font-weight:bold;">:new</span>, <span style="color:#0000FF; font-weight:bold;">nil</span>, build_session_hash_for<span style="color:#006600; font-weight:bold;">&#40;</span>@identity<span style="color:#006600; font-weight:bold;">&#41;</span>
    assert_response <span style="color:#ff3333; font-weight:bold;">:success</span>
    assert_not_nil assigns<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:child</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  specify <span style="color:#996600;">&quot;that it should create child&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    assert_difference <span style="color:#996600;">'Child.count'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      post <span style="color:#ff3333; font-weight:bold;">:create</span>, <span style="color:#006600; font-weight:bold;">&#123;</span>:child <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;">:open_identifier</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;cheese.example.com&quot;</span> <span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#125;</span>, build_session_hash_for<span style="color:#006600; font-weight:bold;">&#40;</span>@identity<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    assert_redirected_to children_url
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>./test/test_helper.rb</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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
</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;">&quot;RAILS_ENV&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#996600;">&quot;test&quot;</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">expand_path</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">dirname</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">__FILE__</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">&quot;/../config/environment&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">expand_path</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">dirname</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">__FILE__</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">&quot;/blueprints&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'test_help'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'machinist'</span> <span style="color:#008000; font-style:italic;">#if you installed as gem rather than plugin</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'faker'</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#6666ff; font-weight:bold;">ActiveSupport::TestCase</span>
  <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">use_transactional_fixtures</span> = <span style="color:#0000FF; font-weight:bold;">true</span>
  <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">use_instantiated_fixtures</span>  = <span style="color:#0000FF; font-weight:bold;">false</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> invalid model
    assert !model.<span style="color:#9900CC;">valid</span>?
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> valid model
    assert model.<span style="color:#9900CC;">valid</span>?
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> validation_message_for model, column, message
    invalid model
    assert_equal message, model.<span style="color:#9900CC;">errors</span>.<span style="color:#9900CC;">on</span><span style="color:#006600; font-weight:bold;">&#40;</span>column<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> valid_identifier
    <span style="color:#996600;">&quot;http://test.example.com/&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> build_session_hash_for identity
    <span style="color:#0066ff; font-weight:bold;">@session_hash</span> = <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#996600;">'identity_id'</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> identity.<span style="color:#9900CC;">id</span><span style="color:#006600; font-weight:bold;">&#125;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> valid_open_id
    <span style="color:#996600;">&quot;test.example.com&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> invalid_open_id
    <span style="color:#996600;">&quot;bad_id&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">def</span> specify <span style="color:#006600; font-weight:bold;">*</span>args, <span style="color:#006600; font-weight:bold;">&amp;</span>block
  test<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">*</span>args, <span style="color:#006600; font-weight:bold;">&amp;</span>block<span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>.. interestingly enough I find that my view that I wrote at some point expects a field called nickname</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&lt;%</span> form_for<span style="color:#006600; font-weight:bold;">&#40;</span>@child<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>f<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
  <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">error_messages</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
  <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">label</span> <span style="color:#ff3333; font-weight:bold;">:nickname</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
  <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">text_field</span> <span style="color:#ff3333; font-weight:bold;">:nickname</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
  <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">label</span> <span style="color:#ff3333; font-weight:bold;">:open_identifier</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
  <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">text_field</span> <span style="color:#ff3333; font-weight:bold;">:open_identifier</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
  <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">submit</span> <span style="color:#996600;">&quot;Add&quot;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
&nbsp;
<span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">%&gt;</span></pre></td></tr></table></div>

<p>So I quickly create and run a migration to add the field.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>chores <span style="color: #7a0874; font-weight: bold;">&#40;</span>chores9<span style="color: #7a0874; font-weight: bold;">&#41;</span>$ ruby script<span style="color: #000000; font-weight: bold;">/</span>generate migration add_nickname_to_child nickname:string
      exists  db<span style="color: #000000; font-weight: bold;">/</span>migrate
      create  db<span style="color: #000000; font-weight: bold;">/</span>migrate<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">20090402191006</span>_add_nickname_to_child.rb</pre></div></div>

<p>which can should be migrated with.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rake db:migrate</pre></div></div>

<p> <a title="Chores on Github" href="http://github.com/rubyyot/chores/tree/master" target="_blank">Here is the design I settled on.</a></p>
<p>As you can see, I&#8217;ve pushed it out to github.  I&#8217;ve tagged it with &#8220;post_9&#8243;.  I am hoping this will help those that want to follow along and reduce the amount of code that I need to post while writing this up.  Maybe I&#8217;ll write up a post on git and github.  <ins datetime="2009-05-10T05:12:45+00:00"></ins></p>
<p><em><strong>Update</strong>: I apologize this is all getting muddled in my brain as well. Between a change in rails versions and the passage of time. I hope to get this all straightened out <a href="http://blog.rubyyot.com/2009/06/chores-a-test-driven-website-part-10/" target="_blank">in the next post</a>. </em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rubyyot.com/2009/05/chores-a-test-driven-website-part-9-the-lost-episode/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Configuring gems for your rails app</title>
		<link>http://blog.rubyyot.com/2009/05/configuring-gems-for-your-rails-app/</link>
		<comments>http://blog.rubyyot.com/2009/05/configuring-gems-for-your-rails-app/#comments</comments>
		<pubDate>Fri, 08 May 2009 16:05:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Rake]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[environment]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://blog.rubyyot.com/?p=339</guid>
		<description><![CDATA[Until I found this (recently), I have been guilty of not configuring my gems for my rails apps.  Apparently these features have been around for a while and can be really helpful when deploying or doing team development with rails and gems.
What it does

Requires gems automatically
Documents the gems you used
Allows you to specify gems by [...]]]></description>
			<content:encoded><![CDATA[<p>Until I found this (recently), I have been guilty of not configuring my gems for my rails apps.  Apparently these features have been around for a while and can be really helpful when deploying or doing team development with rails and gems.</p>
<h3>What it does</h3>
<ul>
<li>Requires gems automatically</li>
<li>Documents the gems you used</li>
<li>Allows you to specify gems by environment.   This is key so you don&#8217;t have to require testing gems for a production environment.</li>
<li>Provides rake tasks for freezing,  installing and checking the status of the required gems.</li>
<li>helps to ensure that functionality you depend on gems for will be working.</li>
</ul>
<h3>Rake Tasks</h3>
<p>Here is a listing of gem related rake tasks.</p>
<pre> rake gems                             # List the gems that this rails application depends on
 rake gems:build                       # Build any native extensions for unpacked gems
 rake gems:install                     # Installs all required gems.
 rake gems:refresh_specs               # Regenerate gem specifications in correct format.
 rake gems:unpack                      # Unpacks all required gems into vendor/gems.
 rake gems:unpack:dependencies         # Unpacks all required gems and their dependencies into vendor/gems.
 rake rails:freeze:gems                # Lock this application to the current gems (by unpacking them into vendor/rails)
 rake rails:unfreeze                   # Unlock this application from freeze of gems or edge and return to a fluid use of system gems</pre>
<ul>
<li><em>rake gems:unpack</em> variants are helpful to make sure that you deploy the same gems from your development environment to your production environment, even if it&#8217;s on a shared host.</li>
<li><em>rake rails:freeze:gems</em> does the same for the rails gems.</li>
<li>A simple <em>rake gems</em> will give you an overview of your gems like this:</li>
</ul>
<pre style="padding-left: 60px;">rubyyot@atlas:$ rake gems</pre>
<pre style="padding-left: 60px;">(in /home/rubyyot/working/examples)</pre>
<pre style="padding-left: 60px;"> - [F] ruby-openid
 - [F] paperclip
 - [I] RedCloth
 - [F] sqlite3-ruby
 - [F] ruby-openid &gt;= 2.0.4</pre>
<pre style="padding-left: 60px;">I = Installed
F = Frozen
R = Framework (loaded before rails starts)</pre>
<h3>Example</h3>
<p>Here are my configured gems from a project I&#8217;m currently working on.</p>
<h5>config/enviroment.rb</h5>

<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;ruby-openid&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:lib</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'openid'</span>
  config.<span style="color:#9900CC;">gem</span> <span style="color:#996600;">&quot;paperclip&quot;</span>
  config.<span style="color:#9900CC;">gem</span> <span style="color:#996600;">&quot;RedCloth&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:lib</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'redcloth'</span></pre></div></div>

<h5>config/environments/development.rb</h5>

<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;sqlite3-ruby&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;sqlite3&quot;</span></pre></div></div>

<h5>config/environments/test.rb</h5>

<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;notahat-machinist&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:lib</span> <span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#996600;">'machinist'</span>, <span style="color:#ff3333; font-weight:bold;">:version</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'0.3.1'</span>
 config.<span style="color:#9900CC;">gem</span> <span style="color:#996600;">&quot;faker&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:version</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'0.3.1'</span>
 config.<span style="color:#9900CC;">gem</span> <span style="color:#996600;">&quot;sqlite3-ruby&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;sqlite3&quot;</span></pre></div></div>

<h5>config/environments/production.rb</h5>

<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;mysql&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;mysql&quot;</span></pre></div></div>

<h3>More</h3>
<p>If you are interested, there is a <a title="Railscasts" href="http://media.railscasts.com/videos/110_gem_dependencies.mov" target="_blank">Railscast episode on this topic.</a><a href="http://media.railscasts.com/videos/110_gem_dependencies.mov"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rubyyot.com/2009/05/configuring-gems-for-your-rails-app/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
<enclosure url="http://media.railscasts.com/videos/110_gem_dependencies.mov" length="11619282" type="video/quicktime" />
		</item>
		<item>
		<title>Making your Rails controllers respond</title>
		<link>http://blog.rubyyot.com/2009/05/making-your-rails-controllers-respond/</link>
		<comments>http://blog.rubyyot.com/2009/05/making-your-rails-controllers-respond/#comments</comments>
		<pubDate>Fri, 08 May 2009 14:00:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[webrat]]></category>

		<guid isPermaLink="false">http://blog.rubyyot.com/?p=341</guid>
		<description><![CDATA[I was looking at Google Analytics today and found that the following searhes often end up here:

webrat no action responded to /. actions: index

and

&#34;no action responded to&#34; webrat

It&#8217;s good to see that people are trying out webrat, presumably with cucumber to test their apps.
The problem here is most likely that you need to add a [...]]]></description>
			<content:encoded><![CDATA[<p>I was looking at Google Analytics today and found that the following searhes often end up here:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">webrat no action responded to <span style="color: #000000; font-weight: bold;">/</span>. actions: index</pre></div></div>

<p>and</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #ff0000;">&quot;no action responded to&quot;</span> webrat</pre></div></div>

<p>It&#8217;s good to see that people are trying out webrat, presumably with cucumber to test their apps.</p>
<p>The problem here is most likely that you need to add a method to your controller to handle the incoming request.  So if you are getting the message</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">no action responded to new</pre></div></div>

<p>you would want to go to the controller that you are testing and add something like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> new
    <span style="color:#008000; font-style:italic;">#TODO make new do something</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>Don&#8217;t forget to add a view such as app/views/example/new.html.erb that corresponds to the action you just added to your controller.</p>
<p>Also, <a href="http://blog.rubyyot.com/2009/05/gtd-on-rails-with-annotations/">learn to find the TODO annotation again with rake.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rubyyot.com/2009/05/making-your-rails-controllers-respond/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GTD on Rails with Annotations</title>
		<link>http://blog.rubyyot.com/2009/05/gtd-on-rails-with-annotations/</link>
		<comments>http://blog.rubyyot.com/2009/05/gtd-on-rails-with-annotations/#comments</comments>
		<pubDate>Thu, 07 May 2009 14:00:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Rake]]></category>
		<category><![CDATA[annotations]]></category>
		<category><![CDATA[notes]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[todo]]></category>

		<guid isPermaLink="false">http://blog.rubyyot.com/?p=340</guid>
		<description><![CDATA[You are in the zone.
Beautiful code is flowing from your fingertips and forming on screen, resolving into a true work of art.
Your tests cover just the right amount of your code, and the few tests that don&#8217;t pass are failures rather than errors; regardless they are corrected within seconds.
The design has taken on a life [...]]]></description>
			<content:encoded><![CDATA[<p>You are in the zone.</p>
<p>Beautiful code is flowing from your fingertips and forming on screen, resolving into a true work of art.</p>
<p>Your tests cover just the right amount of your code, and the few tests that don&#8217;t pass are failures rather than errors; regardless they are corrected within seconds.</p>
<p>The design has taken on a life of it&#8217;s own, and it is spreading tendrils like wisps of smoke outwards in all directions.</p>
<p>It&#8217;s clear that this project will be ready for it&#8217;s first release ahead of schedule, when it happens.</p>
<p>Your thoughts diverge in multiple directions.  You cannot decide which task to persue.  You choose to complete the code that will make your current failing test pass.  But, those other things were pretty important too.  You freeze.  Concentration is lost.  It all falls apart.</p>
<p>Recently I found some rails rake tasks that will help in this situation or anywhere else that you want to place a marker to come back to later; perfect for code reviews as well.</p>
<pre>rake notes                                # Enumerate all annotations                                                                                       
rake notes:custom                         # Enumerate a custom annotation, specify with ANNOTATION=WTFHAX                                                   
rake notes:fixme                          # Enumerate all FIXME annotations                                                                                 
rake notes:optimize                       # Enumerate all OPTIMIZE annotations                                                                              
rake notes:todo                           # Enumerate all TODO annotations</pre>
<p>simply mark the code you are intersted in remembering such as the following</p>
<pre>class ExampleController</pre>
<pre>  def new
    @design = Design.new
    #TODO wookie
  end

  def create
    #OPTIMIZE this needs help
    #FALAFEL yummy in sandwiches.
    @design = Design.new(params[:design])
    @design.profile = Identity.find(current_identity).profile

    #FIXME This was supposed to support xml!
    if @design.save
      flash[:message] = "Design added."
      redirect_to design_url(@design)
    else
      flash[:error] = "Error saving Design."
      render :action =&gt; :new
    end
  end</pre>
<pre>end</pre>
<p>when you run rake notes you get</p>
<pre>rubyyot@atlas:$ rake notes
(in /home/rubyyot/working/example)
app/controllers/example_controller.rb:
  * [ 10] [TODO] wookie
  * [ 14] [OPTIMIZE] this needs help
  * [ 19] [FIXME] This was supposed to support xml!</pre>
<p>Notice you get the exact location of the note along with the type and the text of the note.</p>
<p>Alternatively you could use custom tags with this like this.</p>
<pre>rubyyot@atlas:$ rake notes:custom ANNOTATION=FALAFEL
(in /home/rubyyot/working/example)
app/controllers/example_controller.rb:
  * [ 15] yummy in sandwiches.</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.rubyyot.com/2009/05/gtd-on-rails-with-annotations/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Sqlite3-ruby gem not working on Windows</title>
		<link>http://blog.rubyyot.com/2009/05/sqlite3-ruby-gem-not-working-on-windows/</link>
		<comments>http://blog.rubyyot.com/2009/05/sqlite3-ruby-gem-not-working-on-windows/#comments</comments>
		<pubDate>Tue, 05 May 2009 21:19:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[issues]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[sqlite]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://blog.rubyyot.com/2009/05/sqlite3-ruby-gem-not-working-on-windows/</guid>
		<description><![CDATA[If sqlite3 is having problems building native extensions on Windows, uninstall your current version of the sqlite3-ruby gem.
gem uninstall sqlite3-ruby
and install version 1.2.3
gem install sqlite3-ruby -v1.2.3
]]></description>
			<content:encoded><![CDATA[<p>If sqlite3 is having problems building native extensions on Windows, uninstall your current version of the sqlite3-ruby gem.</p>
<pre>gem uninstall sqlite3-ruby</pre>
<p>and install version 1.2.3</p>
<pre>gem install sqlite3-ruby -v1.2.3</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.rubyyot.com/2009/05/sqlite3-ruby-gem-not-working-on-windows/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Rockstar Coder T-Shirt</title>
		<link>http://blog.rubyyot.com/2009/05/rockstar-coder-t-shirt/</link>
		<comments>http://blog.rubyyot.com/2009/05/rockstar-coder-t-shirt/#comments</comments>
		<pubDate>Sat, 02 May 2009 06:17:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Kung Fu Tees]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Rockstar Coder]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[Tshirt]]></category>

		<guid isPermaLink="false">http://blog.rubyyot.com/?p=332</guid>
		<description><![CDATA[I recently reserved the domain KungFuTees.com to work with my kids to make a variety of T-Shirts that are fun, interesting and, ahem &#8220;hep&#8221;.  So far the project has been a lot of fun and it has been great working together with my kids on a project.  The T-Shirts are printed up by zazzle and [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignright" style="width: 237px"><a href="http://www.zazzle.com/rockstar_coder_tshirt-235670521587248636"><img title="Rockstar Coder" src="http://images.rubyyot.com/rockstar_coder_small.png" alt="Image from back of shirt" width="227" height="400" /></a><p class="wp-caption-text">Image from back of shirt</p></div>
<p>I recently reserved the domain <a title="KungFuTees.com" href="http://KungFuTees.com" target="_blank">KungFuTees.com</a> to work with my kids to make a variety of T-Shirts that are fun, interesting and, ahem &#8220;hep&#8221;.  So far the project has been a lot of fun and it has been great working together with my kids on a project.  The T-Shirts are printed up by zazzle and it&#8217;s been a great opportunity to practice and learn our drawing and image manipulation skills.</p>
<p>Currently the project is still in it&#8217;s infancy, but I wanted to make <a title="Rockstar Coder" href="http://www.zazzle.com/rockstar_coder_tshirt-235670521587248636" target="_blank">this shirt I thought of today while out walking.</a></p>
<h3>Are you a Rockstar?</h3>
<p>Let people know it!  The front of this shirt is blank and the back is a faux Nutritional Facts label similar to those you might find on any packaged food product.</p>
<h3>Ideas?</h3>
<p>Did I get the image wrong?  Can you think of an ingredient that you would rather wear?  Let me know!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rubyyot.com/2009/05/rockstar-coder-t-shirt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Listing of cucumber&#039;s out-of-the-box webrat steps</title>
		<link>http://blog.rubyyot.com/2009/04/listing-of-cucumbers-out-of-the-box-webrat-steps/</link>
		<comments>http://blog.rubyyot.com/2009/04/listing-of-cucumbers-out-of-the-box-webrat-steps/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 18:09:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cucumber]]></category>

		<guid isPermaLink="false">http://blog.rubyyot.com/2009/04/listing-of-cucumbers-out-of-the-box-webrat-steps/</guid>
		<description><![CDATA[Commonly used webrat steps found in cucumber
(replace words in [brackets] with the approprate word.)
Given

Given I am on [page_name]

When

When I go to [page_name]
When I press "[button]"
When I follow "[link]"
When I fill in "[field]" with "[value]"
When I select "[value]" from "[field]"
When I select "[time]" as the date and time				#datetime_select
When I select "[datetime]" as the "[datetime_label]" date and [...]]]></description>
			<content:encoded><![CDATA[<p>Commonly used <a href="http://github.com/brynary/webrat">webrat</a> steps found in <a href="http://github.com/brynary/cucumber">cucumber</a></p>
<p>(replace words in [brackets] with the approprate word.)</p>
<h3>Given</h3>
<pre>
Given I am on [page_name]
</pre>
<h3>When</h3>
<pre>
When I go to [page_name]
When I press "[button]"
When I follow "[link]"
When I fill in "[field]" with "[value]"
When I select "[value]" from "[field]"
When I select "[time]" as the date and time				#datetime_select
When I select "[datetime]" as the "[datetime_label]" date and time	#specific datetime_select
When I select "[time]" as the time			#time select
When I select "[time]" as the "[time_label]" time	#specific time select
When I select "[date]" as the date			#date_select
When I select "[date]" as the "[date_label]" date	#specific date_select
When I check "[field]"
When I uncheck "[field]"
When I choose "[field]"
When I attach the file at "[path]" to "[field]"
</pre>
<h3>Then</h3>
<pre>
Then I should see "[text]"
Then I should not see "[text]"
Then the "[field]" field should contain "[value]"
Then the "[field]" field should not contain "[value]"
Then the "[label]" checkbox should be checked
Then I should be on [page_name]
</pre>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" src="http://img.zemanta.com/pixy.gif?x-id=d61ef58d-41df-8e0a-a2e5-73f18ab347ca" /></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.rubyyot.com/2009/04/listing-of-cucumbers-out-of-the-box-webrat-steps/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
