<?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/"
	>

<channel>
	<title>David Chelimsky</title>
	<atom:link href="http://blog.davidchelimsky.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.davidchelimsky.net</link>
	<description></description>
	<pubDate>Sat, 20 Feb 2010 02:20:35 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Rspec 2.0 in the works</title>
		<link>http://blog.davidchelimsky.net/2010/01/25/rspec-20-in-the-works/</link>
		<comments>http://blog.davidchelimsky.net/2010/01/25/rspec-20-in-the-works/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 03:31:02 +0000</pubDate>
		<dc:creator>David</dc:creator>
		
		<category><![CDATA[RSpec]]></category>

		<guid isPermaLink="false">http://blog.davidchelimsky.net/?p=2609</guid>
		<description><![CDATA[We&#8217;ve started to do some preliminary work on rspec-2.0, which we plan to release before Rails-3 goes final. At that point, the rspec-rails-2.0 plugin/gem will only work with rspec >= 2.0 and rails >= 3.0.

We&#8217;re committed to making the upgrade from rspec-1.x to rspec-2.0 as seamless as possible for most users, but extenders are going [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve started to do some preliminary work on rspec-2.0, which we plan to release before Rails-3 goes final. At that point, the rspec-rails-2.0 plugin/gem will only work with rspec >= 2.0 and rails >= 3.0.</p>

<p>We&#8217;re committed to making the upgrade from rspec-1.x to rspec-2.0 as seamless as possible for most users, but extenders are going to see some differences. This is why we&#8217;re going to take our time with alpha, beta, and candidate releases.</p>

<p>Here are some of the improvements you can expect:</p>

<h3>Modularity</h3>

<p>Following the Rails and Merb models, Rspec-2 will be broken up into component gems and a meta-gem that depends on them. Most users will still <code>gem install rspec</code>, and doing so will install the component gems.</p>

<p>We&#8217;ve broken rspec up into 4 repos in the <a href="http://github.com/rspec">rspec account on github</a>:</p>

<ul>
<li>rspec => meta gem that depends on the others</li>
<li>rspec-core => runner and output formatters</li>
<li>rspec-expectations => <code>should</code> and matchers</li>
<li>rspec-mocks => mocks and stubs</li>
</ul>

<p>With separate component repos, you&#8217;ll be able to use rspec as you do today or mix and match components with other frameworks. This will also make it easier for contributors to contribute to the components they are interested in without worrying about other components.</p>

<h3>New runner extracted from Micronaut</h3>

<p>The <a href="http://github.com/rspec/rspec-core">rspec-core</a> repository is a complete rewrite of the runner, which has been a big sore spot over the years for contributors and extenders. We extracted the runner from <a href="http://github.com/spicycode/micronaut">Micronaut</a>, which is an Rspec-compatible framework written by <a href="http://github.com/spicycode">Chad Humphries</a>.</p>

<p>Micronaut has a simple and powerful metadata model, which allows us to easily slice and dice a spec suite in much the same way we do now with Cucumber using tags. It also helps to simplify rspec&#8217;s own specs (because you can access it from within an example).</p>

<p>Because we&#8217;re able to intercept examples before they are run, we&#8217;ll also be able to offer a clean extension API, allowing you to add structures like <a href="http://merbivore.org/">Merb</a>&#8217;s <code>given</code> blocks without monkey patching. Less monkey patching <code>==</code> more maintainable.</p>

<h3>Where we are today</h3>

<p>While Micronaut runs the same specs that Rspec does, there are some different names for things, and there are some differences in the CLI as well. We&#8217;ve started to resolve some of the differences in <a href="http://github.com/rspec/rspec-core">rspec-core</a>, but we have a way to go.</p>

<p>If you want to try it out and see what works and what doesn&#8217;t, you can either install the prerelease gems (2.0.0.a2 as of this writing):</p>

<p><pre>[sudo] gem install rspec --prerelease</pre></p>

<p>You can also grab the dev environment and have a look at the code. See the <a href="http://github.com/rspec/rspec-dev">rspec-dev README</a> for info.</p>

<p><b><em>Please do not start reporting issues yet as this will only slow us down.</em></b></p>

<p>There is a lot that works, but there is also a lot that doesn&#8217;t. Once we get to beta, we&#8217;ll be looking for feedback and contributions, but for now we just want to let you know where things are.</p>

<p>Rspec 2 uses <code>Rspec</code> as the root namespace and installs an <code>rspec</code> command instead of a <code>spec</code> command. Until we release 2.0.0 final, this will make it easy for you to keep things separate on your system and in your apps. Once we go final we&#8217;ll either alias the old names or release a separate backwards-compatibility wrapper gem that does this for you.</p>

<h3>What&#8217;s next</h3>

<p>We want to focus most of our efforts on rspec-2 at this point, so we don&#8217;t plan any new development on the rspec-1.x series. We&#8217;ll do bug-fix releases of rspec[-rails]-1.3, but no new features.</p>

<p>I&#8217;ll follow up with more information as it becomes clear. Look here for announcements about alpha and beta releases if you&#8217;re interested in trying it out early or getting involved.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.davidchelimsky.net/2010/01/25/rspec-20-in-the-works/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Rspec 2 and Rails 3</title>
		<link>http://blog.davidchelimsky.net/2010/01/12/rspec-2-and-rails-3/</link>
		<comments>http://blog.davidchelimsky.net/2010/01/12/rspec-2-and-rails-3/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 04:12:27 +0000</pubDate>
		<dc:creator>David</dc:creator>
		
		<category><![CDATA[RSpec]]></category>

		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://blog.davidchelimsky.net/?p=2607</guid>
		<description><![CDATA[With the beta release of Rails 3 just around the corner, we&#8217;re planning a 2.0 release of Rspec, with an rspec-rails-2.0 gem for rails-3.0.

Late last week and through the weekend, Engine Yard, Relevance and Obtiva sponsored a meeting with Yehuda Katz, Carl Lerche, Chad Humphries, and me. The four of us laid out some groundwork [...]]]></description>
			<content:encoded><![CDATA[<p>With the beta release of <a href="http://rubyonrails.org">Rails</a> 3 just around the corner, we&#8217;re planning a 2.0 release of <a href="http://rspec.info">Rspec</a>, with an rspec-rails-2.0 gem for rails-3.0.</p>

<p>Late last week and through the weekend, <a href="http://engineyard.com">Engine Yard</a>, <a href="http://thinkrelevance.com">Relevance</a> and <a href="http://obtiva.com">Obtiva</a> sponsored a meeting with <a href="http://yehudakatz.com/">Yehuda Katz</a>, <a href="http://carllerche.com/">Carl Lerche</a>, <a href="http://spicycode.com/">Chad Humphries</a>, and me. The four of us laid out some groundwork and made some good progress toward what promises to be be a very friendly world for Rspec and Rails users and extenders.</p>

<p>Thanks to <a href="http://www.loudthinking.com">David Heinemeier Hansson</a> and the rest of the <a href="http://rubyonrails.org/core">Rails core team</a> for embracing agnosticism without compromising convention over configuration.</p>

<p>I&#8217;ll follow up with details as things shape up, but here is a quick synopsis:</p>

<h3>Rails users</h3>

<p>Whether or not you use Rspec, you&#8217;ll see improvements in some of the built-in assertions, and other testing facilities that ship with Rails.</p>

<h3>Rspec-rails users</h3>

<p>If you do use Rspec, you&#8217;ll see a new rspec-rails plugin/gem that hooks into new features of rails-3 like the new rails generators. You&#8217;ll also see support for Merb-style request specs that wrap Rails&#8217; integration tests.</p>

<h3>Test framework authors</h3>

<p>Rails&#8217; testing APIs will be decoupled from the Test::Unit and Minitest runners. For authors of new testing frameworks, this means that you&#8217;ll be able to include a module in your framework&#8217;s objects instead of having to subclass <code>TestCase</code>. This will make it much easier to experiment with new ideas in the context of Rails, which clearly exposes those ideas to a wider audience than otherwise.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.davidchelimsky.net/2010/01/12/rspec-2-and-rails-3/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Welcome Chad Humphries</title>
		<link>http://blog.davidchelimsky.net/2010/01/12/welcome-chad-humphries/</link>
		<comments>http://blog.davidchelimsky.net/2010/01/12/welcome-chad-humphries/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 04:09:46 +0000</pubDate>
		<dc:creator>David</dc:creator>
		
		<category><![CDATA[RSpec]]></category>

		<guid isPermaLink="false">http://blog.davidchelimsky.net/?p=2605</guid>
		<description><![CDATA[I&#8217;d like to welcome Chad Humphries to the Rspec Development Team.

Chad wrote an Rspec-compatible framework named Micronaut, which runs specs written for Rspec. With Chad on board, we&#8217;re replacing Rspec&#8217;s runner with Micronaut&#8217;s runner for rspec-2.0, which is already in progress and should be released with a new rspec-rails-2.0 plugin/gem in time for the Rails [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;d like to welcome <a href="http://spicycode.com">Chad Humphries</a> to the <a href="http://rspec.info">Rspec</a> Development Team.</p>

<p>Chad wrote an Rspec-compatible framework named <a href="http://github.com/spicycode/micronaut">Micronaut</a>, which runs specs written for Rspec. With Chad on board, we&#8217;re replacing Rspec&#8217;s runner with Micronaut&#8217;s runner for rspec-2.0, which is already in progress and should be released with a new rspec-rails-2.0 plugin/gem in time for the <a href="http://github.com/rails">Rails</a> 3.0 release.</p>

<p>Check back here for more details over the coming days, but in the mean time:</p>

<h4>Welcome, Chad!</h4>
]]></content:encoded>
			<wfw:commentRss>http://blog.davidchelimsky.net/2010/01/12/welcome-chad-humphries/feed/</wfw:commentRss>
		</item>
		<item>
		<title>get off (the couch) with me</title>
		<link>http://blog.davidchelimsky.net/2009/09/25/get-off-the-couch-with-me/</link>
		<comments>http://blog.davidchelimsky.net/2009/09/25/get-off-the-couch-with-me/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 17:46:06 +0000</pubDate>
		<dc:creator>David</dc:creator>
		
		<category><![CDATA[RubyConf]]></category>

		<category><![CDATA[RubyConf5k]]></category>

		<guid isPermaLink="false">http://blog.davidchelimsky.net/?p=2598</guid>
		<description><![CDATA[As Chad Fowler points out in his blog about the unofficial rubyconf 5k, the whole idea was born out of a conversation he and I were having about his new running habit, and how I&#8217;d been trying to get back into running for years and never had the right motivation. Well, there is little motivation [...]]]></description>
			<content:encoded><![CDATA[<p>As <a href="http://chadfowler.com/">Chad Fowler</a> points out in his blog about the <a href="http://chadfowler.com/2009/9/25/unofficial-rubyconf-5k">unofficial rubyconf 5k</a>, the whole idea was born out of a conversation he and I were having about his new running habit, and how I&#8217;d been trying to get back into running for years and never had the right motivation. Well, there is little motivation to get back into it than helping to organize a 5k!</p>

<p>I just started back a little over a week ago and, this week, started the <a href="http://www.coolrunning.com/engine/2/2_3/181.shtml">couch to 5k</a> schedule. For those of you who have never run, or haven&#8217;t run in years, this schedule is absolutely fantastic.</p>

<p>It starts off with with alternating intervals of jogging for a minute and walking for 1.5 minutes for a total of 20 minutes. I immediately found that I was pushing much harder than normal for me during the 1 minute jogs, and after the 20 minutes I felt great! One week into this and I&#8217;m already jogging 8 minutes (sure, not in a row, but <em>8 minutes</em> the 2nd week off the couch!).</p>

<p>Today I dragged my girlfriend along (she&#8217;s planning to run a 5k with me on Thanksgiving morning). Flor exercises regularly, but she is <em>not</em> a runner, yet she had no problem keeping up with me for these short intervals.</p>

<p>Of course I&#8217;m only a week into the schedule, and I&#8217;m sure it will get more challenging as the intervals get longer, but I&#8217;m pretty confident I&#8217;ll be able to keep up with the gradually increasing intensity.</p>

<p>So I encourage any of you who are attending RubyConf (or JRubyConf) to join us. We&#8217;ll have a website up with information and registration in a few weeks, but today is the day to start training! See you at the starting line!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.davidchelimsky.net/2009/09/25/get-off-the-couch-with-me/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The RSpec Book &#8212; Beta 10 and Progress Report</title>
		<link>http://blog.davidchelimsky.net/2009/09/23/the-rspec-book-beta-10-and-progress-report/</link>
		<comments>http://blog.davidchelimsky.net/2009/09/23/the-rspec-book-beta-10-and-progress-report/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 13:09:15 +0000</pubDate>
		<dc:creator>David</dc:creator>
		
		<category><![CDATA[BDD]]></category>

		<category><![CDATA[Cucumber]]></category>

		<category><![CDATA[RSpec]]></category>

		<category><![CDATA[The RSpec Book]]></category>

		<guid isPermaLink="false">http://blog.davidchelimsky.net/?p=2592</guid>
		<description><![CDATA[Beta 10????? When the hell are we going to start chopping down some trees? Well, first, here&#8217;s what&#8217;s new in Beta 10 of The RSpec Book:

Automating the Browser with Webrat and Selenium

This new chapter from Bryan Helmkamp shows you how to drive Cucumber scenarios right through your browser using Webrat and Selenium. You&#8217;ll type a [...]]]></description>
			<content:encoded><![CDATA[<p>Beta 10????? When the hell are we going to start chopping down some trees? Well, first, here&#8217;s what&#8217;s new in Beta 10 of <a href="http://www.pragprog.com/titles/achbd/the-rspec-book">The RSpec Book</a>:</p>

<h3>Automating the Browser with Webrat and Selenium</h3>

<p>This new chapter from Bryan Helmkamp shows you how to drive Cucumber scenarios right through your browser using Webrat and Selenium. You&#8217;ll type a single command and watch a browser fire up and walk through each scenario step by step right before your very eyes, and then see a standard Cucumber report in the shell. It&#8217;s a sight to behold, and a great way to drive out behaviour that requires JavaScript.</p>

<p>And now, for your reading pleasure &#8230;
<span id="more-2592"></span></p>

<h3>Progress Report</h3>

<p>I&#8217;m sure that all of you post-first-time authors out there know what I mean when I say that working on this book has been a fascinating case study in how <em>not</em> to write a book. First, we&#8217;re writing about not just one, but no less that six moving targets: RSpec, Cucumber, Rails, Webrat, Selenium and, of course BDD itself.</p>

<p>When we started this book, BDD was seen primarily as <a href="http://techblog.daveastels.com/2005/07/05/a-new-look-at-test-driven-development/">a new look at test driven development</a>. The book was focused only on RSpec and TDD through this new lens. Had we stuck to that we might be talking about the third edition by now, but while we were writing, BDD was on the move.</p>

<h4>BDD in 2009</h4>

<p>Today, BDD has evolved to a full-stack agile process derived from Extreme Programming (XP). Rather than being a variation of TDD, it comprises TDD (and ATDP, DDD, etc, etc). And so has the book evolved to incorporate the application of these ideas to the practical use of an evolving toolset.</p>

<p>Also consider that four of the authors are primary maintainers of said moving targets (including BDD itself). Structuring a project like this leads to a different meaning of BDD entirely &#8230;</p>

<h4>Book Driven Development</h4>

<p>I can&#8217;t count the number of times that I&#8217;ve been writing about how to do something or set something up in RSpec or Cucumber and I&#8217;ve thought &#8220;Really? We could do better than that!&#8221; Each of those revelations led to software updates, followed by me poring through the book to update related content.</p>

<p>The end result is better software <em>and</em> a better book, benefiting RSpec and Cucumber users and The RSpec Book readers alike.</p>

<h4>What remains to be done?</h4>

<p>At this point we&#8217;re pretty close to the end of this journey. 
We&#8217;ve got two chapters left to write, plus some bookends (and beginnings - foreword, preface, and appendices). I also need to review pretty much everything because lots of things that we wrote about earlier in the process have changed.</p>

<p>After all that, we&#8217;ll have a final technical review, copyediting, indexing, and then off to print! So we&#8217;re in the final phases now and I look forward to reporting that the book is off to print in the not too distant future. How &#8220;not too distant&#8221; I hesitate to say, because so far I&#8217;m batting 000 in terms of release predictions (and I thought estimating software delivery was a challenge!).</p>

<p>In the mean time, I&#8217;ll be posting updates here as we progress, along with some discussion of the material in the book.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.davidchelimsky.net/2009/09/23/the-rspec-book-beta-10-and-progress-report/feed/</wfw:commentRss>
		</item>
		<item>
		<title>let it be @-less</title>
		<link>http://blog.davidchelimsky.net/2009/09/15/let-it-be-less/</link>
		<comments>http://blog.davidchelimsky.net/2009/09/15/let-it-be-less/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 01:57:08 +0000</pubDate>
		<dc:creator>David</dc:creator>
		
		<category><![CDATA[RSpec]]></category>

		<guid isPermaLink="false">http://blog.davidchelimsky.net/?p=2588</guid>
		<description><![CDATA[If you use RSpec and you&#8217;re disciplined about the red/green/refactor of Test Driven Development, you probably find yourself doing this from time to time. We start off with a single example:


describe BowlingGame do
  it &#34;scores all gutters with 0&#34; do
    game = BowlingGame.new
    20.times &#123; game.roll&#40;0&#41; &#125;
  [...]]]></description>
			<content:encoded><![CDATA[<p>If you use RSpec and you&#8217;re disciplined about the red/green/refactor of Test Driven Development, you probably find yourself doing this from time to time. We start off with a single example:</p>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">describe BowlingGame <span style="color:#9966CC; font-weight:bold;">do</span>
  it <span style="color:#996600;">&quot;scores all gutters with 0&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    game = BowlingGame.<span style="color:#9900CC;">new</span>
    20.<span style="color:#9900CC;">times</span> <span style="color:#006600; font-weight:bold;">&#123;</span> game.<span style="color:#9900CC;">roll</span><span style="color:#006600; font-weight:bold;">&#40;</span>0<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
    game.<span style="color:#9900CC;">score</span>.<span style="color:#9900CC;">should</span> == 0
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>


<p>Then add second example:</p>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">describe BowlingGame <span style="color:#9966CC; font-weight:bold;">do</span>
  it <span style="color:#996600;">&quot;scores all gutters with 0&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    game = BowlingGame.<span style="color:#9900CC;">new</span>
    20.<span style="color:#9900CC;">times</span> <span style="color:#006600; font-weight:bold;">&#123;</span> game.<span style="color:#9900CC;">roll</span><span style="color:#006600; font-weight:bold;">&#40;</span>0<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
    game.<span style="color:#9900CC;">score</span>.<span style="color:#9900CC;">should</span> == 0
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  it <span style="color:#996600;">&quot;scores all 1's with 20&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    game = BowlingGame.<span style="color:#9900CC;">new</span>
    20.<span style="color:#9900CC;">times</span> <span style="color:#006600; font-weight:bold;">&#123;</span> game.<span style="color:#9900CC;">roll</span><span style="color:#006600; font-weight:bold;">&#40;</span>1<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
    game.<span style="color:#9900CC;">score</span>.<span style="color:#9900CC;">should</span> == 20
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>


<p>Once we get the second example passing, we remove duplication in the examples, typically like this:</p>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">describe BowlingGame <span style="color:#9966CC; font-weight:bold;">do</span>
  before<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:each</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    <span style="color:#0066ff; font-weight:bold;">@game</span> = BowlingGame.<span style="color:#9900CC;">new</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  it <span style="color:#996600;">&quot;scores all gutters with 0&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    20.<span style="color:#9900CC;">times</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#0066ff; font-weight:bold;">@game</span>.<span style="color:#9900CC;">roll</span><span style="color:#006600; font-weight:bold;">&#40;</span>0<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
    <span style="color:#0066ff; font-weight:bold;">@game</span>.<span style="color:#9900CC;">score</span>.<span style="color:#9900CC;">should</span> == 0
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  it <span style="color:#996600;">&quot;scores all 1's with 20&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    20.<span style="color:#9900CC;">times</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#0066ff; font-weight:bold;">@game</span>.<span style="color:#9900CC;">roll</span><span style="color:#006600; font-weight:bold;">&#40;</span>1<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
    <span style="color:#0066ff; font-weight:bold;">@game</span>.<span style="color:#9900CC;">score</span>.<span style="color:#9900CC;">should</span> == 20
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>


<p>This last step involves copying the first line of each example to a <code>before(:each)</code> block, and then converting the references to <code>game</code> to an instance variable using an <code>@</code> symbol. This is tedious and error prone, but we accept that in the interest of keeping things clean.</p>

<p><span id="more-2588"></span></p>

<h3>a convention emerges</h3>

<p>One convention that has emerged over time is to introduce a helper method, like so:</p>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">describe BowlingGame <span style="color:#9966CC; font-weight:bold;">do</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> game
    <span style="color:#0066ff; font-weight:bold;">@game</span> <span style="color:#006600; font-weight:bold;">||</span>= BowlingGame.<span style="color:#9900CC;">new</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  it <span style="color:#996600;">&quot;scores all gutters with 0&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    20.<span style="color:#9900CC;">times</span> <span style="color:#006600; font-weight:bold;">&#123;</span> game.<span style="color:#9900CC;">roll</span><span style="color:#006600; font-weight:bold;">&#40;</span>0<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
    game.<span style="color:#9900CC;">score</span>.<span style="color:#9900CC;">should</span> == 0
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  it <span style="color:#996600;">&quot;scores all 1's with 20&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    20.<span style="color:#9900CC;">times</span> <span style="color:#006600; font-weight:bold;">&#123;</span> game.<span style="color:#9900CC;">roll</span><span style="color:#006600; font-weight:bold;">&#40;</span>1<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
    game.<span style="color:#9900CC;">score</span>.<span style="color:#9900CC;">should</span> == 20
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>


<p>With the first call to the <code>game</code> method in each example, ruby invokes the right side of the expression and stores it in the <code>@game</code> variable on the left, which is returned to the current and each subsquent caller. This approach takes up the same number of lines as the <code>before(:each)</code> block, but note the lack of <code>@</code> symbols in the examples themselves.</p>

<p>Consider that there will likely be several more examples that have a similar structure, and you can see that the removal of <code>@</code> symbols reduces a fair amount of noise. Not that there&#8217;s anything inherently wrong or noisy about instance variables, but for many this may just feel cleaner.</p>

<h3>from convention emerges solution</h3>

<p>Thanks to a suggestion from Stuart Halloway, rspec-1.2.9 introduces a new <code>let()</code> method that lets examples move towards @-less-ness by encapsulating the process of caching the instance variable. Here&#8217;s the previous example using <code>let()</code>:</p>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">describe BowlingGame <span style="color:#9966CC; font-weight:bold;">do</span>
  let<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:game</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> BowlingGame.<span style="color:#9900CC;">new</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
  it <span style="color:#996600;">&quot;scores all gutters with 0&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    20.<span style="color:#9900CC;">times</span> <span style="color:#006600; font-weight:bold;">&#123;</span> game.<span style="color:#9900CC;">roll</span><span style="color:#006600; font-weight:bold;">&#40;</span>0<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
    game.<span style="color:#9900CC;">score</span>.<span style="color:#9900CC;">should</span> == 0
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  it <span style="color:#996600;">&quot;scores all 1's with 20&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    20.<span style="color:#9900CC;">times</span> <span style="color:#006600; font-weight:bold;">&#123;</span> game.<span style="color:#9900CC;">roll</span><span style="color:#006600; font-weight:bold;">&#40;</span>1<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
    game.<span style="color:#9900CC;">score</span>.<span style="color:#9900CC;">should</span> == 20
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>


<p>The call to <code>let()</code> in this example defines a <code>game</code> method. The first time <code>game</code> is called in each example, it invokes the block, caches the result (an instance of <code>BowlingGame</code>), and returns it. Each subsequent call to <code>game</code> returns the same object, just like the <code>game</code> method in the previous example.</p>

<p>This will, admittedly, not change your life. Nor will it appeal to all of you, though I expect it to appeal to the lispier among you. The thing that I&#8217;ve noticed is that as more of these appear in a codebase, the more meaning they begin to establish, and it actually helps to compartmentalize this pattern and separate it from other helper methods that might be floating around.</p>

<p>So experiment away and please feel free to provide feedback here or on the <a href="http://rubyforge.org/mailman/listinfo/rspec-users">rspec-users</a> mailing list.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.davidchelimsky.net/2009/09/15/let-it-be-less/feed/</wfw:commentRss>
		</item>
		<item>
		<title>rspec-1.2.9.rc1 and rspec-rails-1.2.9.rc1 have been released</title>
		<link>http://blog.davidchelimsky.net/2009/09/15/rspec-129rc1-and-rspec-rails-129rc1-have-been-released/</link>
		<comments>http://blog.davidchelimsky.net/2009/09/15/rspec-129rc1-and-rspec-rails-129rc1-have-been-released/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 01:00:15 +0000</pubDate>
		<dc:creator>David</dc:creator>
		
		<category><![CDATA[RSpec]]></category>

		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://blog.davidchelimsky.net/?p=2584</guid>
		<description><![CDATA[release candidates

We&#8217;re using the new rubygems prerelease feature to do proper release candidates. This feature was introduced to rubygems a couple of versions back, but I&#8217;d recommend updating to rubygems-1.3.5 before installing the rspec prerelease gems.

For those unfamiliar with this new rubygems feature, you have to add the --prerelease flag in order to see and [...]]]></description>
			<content:encoded><![CDATA[<h2>release candidates</h2>

<p>We&#8217;re using the new rubygems prerelease feature to do proper release candidates. This feature was introduced to rubygems a couple of versions back, but I&#8217;d recommend updating to rubygems-1.3.5 before installing the rspec prerelease gems.</p>

<p>For those unfamiliar with this new rubygems feature, you have to add the <code>--prerelease</code> flag in order to see and install these gems:</p>

<pre><code>$ gem search --remote --prerelease rspec

  *** REMOTE GEMS ***

  rspec (1.2.9.rc1)
  rspec-rails (1.2.9.rc1)

$ [sudo] gem install --prerelease rspec
$ [sudo] gem install --prerelease rspec-rails
</code></pre>

<p>This way only those who choose to install the prerelease gems will get them, while those who exclude the &#8211;prerelease flag will get the previous final release (rspec-1.2.8, rspec-rails-1.2.7.1).</p>

<p>Once you install the prerelease gems, Rubygems will treat 1.2.9.rc1 as a higher version than 1.2.8, but a lower version than 1.2.9. That way when we do the final release you&#8217;ll be able to just install 1.2.9 and it will take its rightful place ahead of 1.2.9.rc1 without you having to uninstall rc1.</p>

<p>I invite you to install these prerelease gems and report any issues you run into to http://rspec.lighthouseapp.com/rspec. Advanced thanks to those who help the rest by breaking these in.</p>

<h2>changes</h2>

<p>Here are the changelogs for both rspec and rspec-rails. I&#8217;ll post separately about some of the new features in more detail.</p>

<h3>rspec-1.2.9-rc1</h3>

<ul>
<li><p>enhancements</p>

<ul>
<li>manage backtrace-ignore patterns with Spec::Runner.configure (Martin Emde). Closes #870.</li>
<li>friendly mock argument expectation failure message (Tim Harper). Closes #868.</li>
<li>added double() as alias for stub() and mock()</li>
<li>failure messages for doubles, mocks and stubs use the right name</li>
<li>add let() method to assign memoized attributes (suggestion from Stuart Halloway). Closes #857.</li>
<li>add its method so you can say:
describe Array do
its(:length) { should == 0 }
(Stephen Touset). Closes #833</li>
<li>spec command automatically uses spec/spec.opts if it is present
(suggestion from Yehuda Katz)</li>
<li>rspec now adds PROJECT_ROOT/lib and PROJECT_ROOT/spec to the load path</li>
<li>determines PROJECT_ROOT by recursing up until it finds a directory
that has a ./spec directory (thanks to Scott Taylor)</li>
<li>supports require &#8217;spec_helper&#8217;</li>
<li>supports running specs from the PROJECT_ROOT or any directory
below it</li>
<li>closes #733</li>
</ul></li>
<li><p>not really a bug fix or enhancement</p>

<ul>
<li>temporarily moved heckle feature to features-pending (waiting to see what
happens with
http://rubyforge.org/tracker/index.php?func=detail&amp;aid=26786&amp;group_id=1513&amp;atid=5921)</li>
</ul></li>
</ul>

<h3>rspec-rails-1.2.9-rc1</h3>

<ul>
<li><p>enhancements</p>

<ul>
<li>added route_to and be_routable matchers (Randy Harmon). Closes #843.</li>
<li>Provide better failure message for render_template when redirected (Josh Nichols). Closes #885.</li>
<li>generated specs require &#8217;spec_helper&#8217;</li>
</ul></li>
<li><p>bug fixes</p>

<ul>
<li>pass the correct args to super in controller#render depending on
the rails version (Lucas Carlson). Closes #865.</li>
<li>use Rack::Utils.parse_query to convert query strings to hashes. Closes #872.</li>
<li>errors correctly bubble up when a controller spec in isolation
mode requests a non-existent action/template</li>
<li>no error if either action or template exist</li>
<li>error if neither exist</li>
<li>Closes #888.</li>
</ul></li>
<li><p>removals</p>

<ul>
<li>spec_server has been removed in favor of spork.</li>
<li>You can still use the &#8211;drb flag, but you&#8217;ve got to install the spork gem.</li>
<li>Windows users who cannot use the spork gem can install the
spec&#95;server from http://github.com/dchelimsky/spec_server</li>
</ul></li>
<li><p><a href="http://rspec.info">http://rspec.info</a></p></li>
<li><a href="http://rubyforge.org/projects/rspec">http://rubyforge.org/projects/rspec</a></li>
<li><a href="http://github.com/dchelimsky/rspec">http://github.com/dchelimsky/rspec</a></li>
<li><a href="http://github.com/dchelimsky/rspec-rails">http://github.com/dchelimsky/rspec-rails</a></li>
<li><a href="http://wiki.github.com/dchelimsky/rspec">http://wiki.github.com/dchelimsky/rspec</a></li>
<li><a href="&#x6d;&#97;&#105;&#x6c;&#x74;&#111;&#58;&#x72;&#x73;&#112;&#101;&#x63;&#x2d;&#117;&#115;&#x65;&#x72;&#115;&#64;&#x72;&#x75;&#98;&#121;&#x66;&#x6f;&#114;&#103;&#x65;&#x2e;&#111;&#114;&#x67;">&#x72;&#x73;&#112;&#101;&#x63;&#x2d;&#117;&#115;&#x65;&#x72;&#115;&#64;&#x72;&#x75;&#98;&#121;&#x66;&#x6f;&#114;&#103;&#x65;&#x2e;&#111;&#114;&#x67;</a></li>
<li><a href="&#x6d;&#x61;&#x69;&#108;&#116;&#111;:&#x72;&#x73;&#x70;&#101;&#99;&#45;d&#x65;&#x76;&#x65;&#108;&#64;&#114;u&#x62;&#x79;&#x66;&#111;&#114;&#103;e&#x2e;&#x6f;&#x72;&#103;">&#x72;&#x73;&#x70;&#101;&#99;&#45;d&#x65;&#x76;&#x65;&#108;&#64;&#114;u&#x62;&#x79;&#x66;&#111;&#114;&#103;e&#x2e;&#x6f;&#x72;&#103;</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.davidchelimsky.net/2009/09/15/rspec-129rc1-and-rspec-rails-129rc1-have-been-released/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Windy City Rails</title>
		<link>http://blog.davidchelimsky.net/2009/07/18/windy-city-rails/</link>
		<comments>http://blog.davidchelimsky.net/2009/07/18/windy-city-rails/#comments</comments>
		<pubDate>Sat, 18 Jul 2009 07:12:50 +0000</pubDate>
		<dc:creator>David</dc:creator>
		
		<category><![CDATA[BDD]]></category>

		<category><![CDATA[Cucumber]]></category>

		<category><![CDATA[Presentations]]></category>

		<category><![CDATA[RSpec]]></category>

		<guid isPermaLink="false">http://blog.davidchelimsky.net/?p=2538</guid>
		<description><![CDATA[I&#8217;m presenting at Windy City Rails in September. This is just the second year of this exciting midwest Rails conference, but the schedule looks most impressive. Talks range from How To Test Absolutely Anything to Better Ruby through Functional Programming to a Rails 3 Update from Yehuda Katz, Rails core&#8217;s newest member and the man [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m presenting at <a href="http://windycityrails.org/">Windy City Rails</a> in September. This is just the second year of this exciting midwest Rails conference, but the <a href="http://windycityrails.org/schedule">schedule looks most impressive</a>. Talks range from <a href="http://windycityrails.org/sessions#rappin">How To Test Absolutely Anything</a> to <a href="http://windycityrails.org/sessions#wampler">Better Ruby through Functional Programming</a> to a <a href="http://windycityrails.org/sessions#katz">Rails 3 Update</a> from <a href="http://yehudakatz.com/">Yehuda Katz</a>, Rails core&#8217;s newest member and the man who is bringing the best of Merb to Rails 3.</p>

<p>Last year I did a <a href="http://vimeo.com/5573653">presentation about BDD</a> and, with such a wide subject, ran out of time before I got through most of it. This year, the  organizers of the conference have given me the opportunity to talk for three full hours! Count &#8216;em. Three!</p>

<p>It&#8217;s actually not just me talking (whew!). It&#8217;s a tutorial entitled <a href="http://windycityrails.org/sessions#chelimsky">Behaviour Driven Rails with RSpec and Cucumber</a>. I&#8217;m planning an intensive skills development workshop, taking attendees through the development of a feature in a Rails app from planning to writing Cucumber scenarios to driving out code with RSpec. This is going to be about as close as you&#8217;ll get to a BDD immersion in three hours, so I hope to see you there whether you&#8217;re just learning about BDD now or you&#8217;ve already been doing it for a while.</p>

<p>See you in September!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.davidchelimsky.net/2009/07/18/windy-city-rails/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The RSpec Book: Beta 8.0</title>
		<link>http://blog.davidchelimsky.net/2009/07/18/the-rspec-book-beta-80/</link>
		<comments>http://blog.davidchelimsky.net/2009/07/18/the-rspec-book-beta-80/#comments</comments>
		<pubDate>Sat, 18 Jul 2009 06:49:08 +0000</pubDate>
		<dc:creator>David</dc:creator>
		
		<category><![CDATA[RSpec]]></category>

		<category><![CDATA[The RSpec Book]]></category>

		<guid isPermaLink="false">http://blog.davidchelimsky.net/?p=2534</guid>
		<description><![CDATA[The RSpec Book Beta 8.0 was just released. This release includes a number of fixed errata and one new chapter. Yes, only one chapter, but its a doozy:

Managing Complexity in Step Definitions

This chapter introduces a random generator to the Codebreaker game. This brings up several issues that can add complexity to Cucumber scenarios, RSpec code [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://pragprog.com/titles/achbd/the-rspec-book">The RSpec Book</a> Beta 8.0 was just released. This release includes a number of fixed <a href="http://pragprog.com/titles/achbd/errata">errata</a> and one new chapter. Yes, only one chapter, but its a doozy:</p>

<h4>Managing Complexity in Step Definitions</h4>

<p>This chapter introduces a random generator to the Codebreaker game. This brings up several issues that can add complexity to Cucumber scenarios, RSpec code examples, and the code we&#8217;re driving out with the aid of these tools and the BDD process. We address these issues and offer strategies to manage the complexity they introduce.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.davidchelimsky.net/2009/07/18/the-rspec-book-beta-80/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The RSpec Book: Beta 6.0</title>
		<link>http://blog.davidchelimsky.net/2009/06/17/the-rspec-book-beta-60/</link>
		<comments>http://blog.davidchelimsky.net/2009/06/17/the-rspec-book-beta-60/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 02:08:04 +0000</pubDate>
		<dc:creator>David</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.davidchelimsky.net/?p=2526</guid>
		<description><![CDATA[The RSpec Book Beta 6.0 was just released. This release includes a number of fixed errata, two new chapters, and a bit of re-organization.

Hello

We added a new chapter with basic install instructions and basic Hello
Cucumber and Hello RSpec examples.

Rails Models

Covers writing model specs, validations, associations, mocks, test data
builders and more.

Automating Features with Cucumber

We split Describing [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://pragprog.com/titles/achbd/the-rspec-book">The RSpec Book</a> Beta 6.0 was just released. This release includes a number of fixed <a href="http://pragprog.com/titles/achbd/errata">errata</a>, two new chapters, and a bit of re-organization.</p>

<h4>Hello</h4>

<p>We added a new chapter with basic install instructions and basic Hello
Cucumber and Hello RSpec examples.</p>

<h4>Rails Models</h4>

<p>Covers writing model specs, validations, associations, mocks, test data
builders and more.</p>

<h4>Automating Features with Cucumber</h4>

<p>We split Describing Features with Cucumber into two chapters: Describing
Features with Cucumber and Automating Features with Cucumber. This allowed us
to expand the material on planning the first release and iteration in the
first chapter, and keep of the technical <em>in the trenches</em> material
in the second.</p>

<p>Even if you&#8217;ve already read through the tutorial in previous beta releases,
you&#8217;re going to want to re-read these two chapters.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.davidchelimsky.net/2009/06/17/the-rspec-book-beta-60/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
