<?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>Sarah Mei &#187; ruby</title>
	<atom:link href="http://www.sarahmei.com/blog/category/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sarahmei.com/blog</link>
	<description></description>
	<lastBuildDate>Sun, 25 Jul 2010 23:48:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>RailsConf Slides &#8211; Beyond (No)SQL</title>
		<link>http://www.sarahmei.com/blog/2010/06/09/railsconf-slides/</link>
		<comments>http://www.sarahmei.com/blog/2010/06/09/railsconf-slides/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 16:26:54 +0000</pubDate>
		<dc:creator>sarahmei</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[databases]]></category>
		<category><![CDATA[nosql]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[railsconf]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.sarahmei.com/blog/?p=544</guid>
		<description><![CDATA[Preliminary slides for my RailsConf talk I&#8217;m giving this afternoon on conceptual tools for evaluating databases. Contains some profanity at the beginning. Slides are subject to change since I haven&#8217;t actually given the talk yet!

Beyond (No)SQL
View more presentations from Sarah Mei.

]]></description>
			<content:encoded><![CDATA[<p>Preliminary slides for my RailsConf talk I&#8217;m giving this afternoon on conceptual tools for evaluating databases. <strong>Contains some profanity at the beginning.</strong> Slides are subject to change since I haven&#8217;t actually given the talk yet!<br />
<span id="more-544"></span></p>
<div style="width:425px" id="__ss_4453924"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/sarahmei/beyond-nosql" title="Beyond (No)SQL">Beyond (No)SQL</a></strong><object id="__sse4453924" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=beyond-no-sql-100609112040-phpapp02&#038;stripped_title=beyond-nosql" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed name="__sse4453924" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=beyond-no-sql-100609112040-phpapp02&#038;stripped_title=beyond-nosql" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="padding:5px 0 12px">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/sarahmei">Sarah Mei</a>.</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sarahmei.com/blog/2010/06/09/railsconf-slides/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Outside-In BDD: How?!</title>
		<link>http://www.sarahmei.com/blog/2010/05/29/outside-in-bdd/</link>
		<comments>http://www.sarahmei.com/blog/2010/05/29/outside-in-bdd/#comments</comments>
		<pubDate>Sun, 30 May 2010 03:14:55 +0000</pubDate>
		<dc:creator>sarahmei</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[bdd]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rspec]]></category>

		<guid isPermaLink="false">http://www.sarahmei.com/blog/?p=443</guid>
		<description><![CDATA[I use rspec on every project, and I&#8217;ve started adding cucumber to all my projects in the last few months. There&#8217;s lots of information out there about how to set up and use cucumber, but there isn&#8217;t much covering your developer workflow when you&#8217;re using these tools.
How do you start, and how do you know [...]]]></description>
			<content:encoded><![CDATA[<p>I use <a href="http://rspec.info/">rspec</a> on every project, and I&#8217;ve started adding <a href="http://cukes.info">cucumber</a> to all my projects in the last few months. There&#8217;s lots of information out there about how to set up and use cucumber, but there isn&#8217;t much covering your developer workflow when you&#8217;re using these tools.</p>
<p>How do you start, and how do you know you&#8217;re finished? What do you test, and where? These questions can be answered hundreds of different ways, but here&#8217;s my way.<br />
<span id="more-443"></span></p>
<h2>The first code I write: a feature</h2>
<p>As a developer, rather than a designer, I&#8217;m always tempted to start with unit tests and work out towards a cucumber feature (&#8220;inside-out&#8221; testing). But that approach gets me into no end of trouble. I usually end up writing and testing stuff on the model that I don&#8217;t ultimately need. Plus once I&#8217;m down in the weeds coding, I lose track of the big picture.</p>
<p>So I like to do outside-in testing instead. I start each story I get from <a href="http://pivotaltracker.com">tracker</a> with a cucumber feature that expresses how the PM will be able to accept it when I&#8217;m done. The feature helps me frame the problem properly, and focus on doing exactly what I need to make it work. Since I come back to it periodically while I&#8217;m coding, I keep focused on the higher-level goal. And finally &#8211; if I write it first, I can&#8217;t skip writing it once I&#8217;m done.</p>
<h2>Before we get going&#8230;</h2>
<p>There are certain types of tests I don&#8217;t write in this example (and in some cases, at all). Let&#8217;s get those out of the way so you don&#8217;t have to come up with a scathing comment at the bottom of the post.</p>
<ul>
<li><strong>Model tests.</strong> In this example, my model doesn&#8217;t do anything other than default ActiveRecord behavior, so it doesn&#8217;t need any tests. <strong>Don&#8217;t test rails internals.</strong> Once my model has custom behavior, it will have specs, too.</li>
<li><strong>View tests.</strong> I have no tests that verify that my markup is what I expect. That&#8217;s because they&#8217;re a waste of time. Yes, even with complex views. Verify behavior with cucumber tests, unit-test Javascript with <a href="http://github.com/pivotal/jasmine">jasmine</a>, and leave the rest to the humans. You&#8217;ll waste more developer time maintaining them than it would take humans to verify them. Verifiers are a whole lot cheaper than developers.</li>
<li><strong>Error case tests.</strong> In this example, there are no error cases. The model has no validations, and the table has no constraints. Once there are error cases, I generally put those in the model if I can, in the controller when I have to, and never in the cucumber tests. The latter is mostly a suite-speed consideration &#8211; cucumber tests run much more slowly than rspec. Cucumber&#8217;s great for for happy path tests; I leave the rest to rspec.</li>
</ul>
<p>Let&#8217;s get going!</p>
<h2>The first feature</h2>
<p>Say I&#8217;m doing a library app and the first story is &#8220;User can enter a new book into the system.&#8221; Before I write any other code, I write this feature:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">Feature: User manages books
  Scenario: User adds a new book
    Given I go to the new book page
    <span style="color:#9966CC; font-weight:bold;">And</span> I fill <span style="color:#9966CC; font-weight:bold;">in</span> <span style="color:#996600;">&quot;Name&quot;</span> with <span style="color:#996600;">&quot;War &amp; Peace&quot;</span>
    <span style="color:#9966CC; font-weight:bold;">And</span> I fill <span style="color:#9966CC; font-weight:bold;">in</span> <span style="color:#996600;">&quot;Description&quot;</span> with <span style="color:#996600;">&quot;Long Russian novel&quot;</span>
    <span style="color:#9966CC; font-weight:bold;">When</span> I press <span style="color:#996600;">&quot;Create&quot;</span>
    <span style="color:#9966CC; font-weight:bold;">Then</span> I should be on the book list page
    <span style="color:#9966CC; font-weight:bold;">And</span> I should see <span style="color:#996600;">&quot;War &amp; Peace&quot;</span></pre></div></div>

<h2>Starting the fail-fix cycle</h2>
<p>I run it using <code>cucumber features</code>, and it fails on the first line &#8211; <code>Given I go to the new book page</code> &#8211; because cucumber doesn&#8217;t know where the &#8220;new book page&#8221; is. So I add that to the cucumber paths helper.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">    <span style="color:#9966CC; font-weight:bold;">when</span> <span style="color:#006600; font-weight:bold;">/</span>the new book page<span style="color:#006600; font-weight:bold;">/</span>
      new_book_path</pre></div></div>

<p>Now when I run cucumber, it fails because it can&#8217;t find <code>new_book_path</code>. So I add that to <code>routes.rb</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  map.<span style="color:#9900CC;">resources</span> <span style="color:#ff3333; font-weight:bold;">:books</span>, <span style="color:#ff3333; font-weight:bold;">:only</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:new</span><span style="color:#006600; font-weight:bold;">&#93;</span></pre></div></div>

<p>Now when I run cucumber, it complains that it can&#8217;t find the BooksController. That means it&#8217;s time to dive down to rspec controller tests. </p>
<h2>My first spec experience</h2>
<p>I create <code>books_controller_spec.rb</code> in spec/controllers, and add a test for the <code>new</code> method:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><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;">join</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:#996600;">'..'</span>, <span style="color:#996600;">'spec_helper.rb'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
describe BooksController <span style="color:#9966CC; font-weight:bold;">do</span>
  describe <span style="color:#996600;">&quot;#new&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    it <span style="color:#996600;">&quot;should be successful&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      get <span style="color:#ff3333; font-weight:bold;">:new</span>
      response.<span style="color:#9900CC;">should</span> be_success
    <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></div></div>

<p>When I run this spec, it complains that there is no BooksController. Fixed:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> BooksController <span style="color:#006600; font-weight:bold;">&lt;</span> ApplicationController 
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p></code><br />
I re-run the spec and get "no action responded to new." So I add the <code>new</code> method.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> BooksController <span style="color:#006600; font-weight:bold;">&lt;</span> ApplicationController
  <span style="color:#9966CC; font-weight:bold;">def</span> new
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Now the spec passes! Time to check back with cucumber.</p>
<h2>Getting past the first line</h2>
<p>I read through my cucumber feature again:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">Feature: User manages books
  Scenario: User adds a new book
    Given I go to the new book page
    <span style="color:#9966CC; font-weight:bold;">And</span> I fill <span style="color:#9966CC; font-weight:bold;">in</span> <span style="color:#996600;">&quot;Name&quot;</span> with <span style="color:#996600;">&quot;War &amp; Peace&quot;</span>
    <span style="color:#9966CC; font-weight:bold;">And</span> I fill <span style="color:#9966CC; font-weight:bold;">in</span> <span style="color:#996600;">&quot;Description&quot;</span> with <span style="color:#996600;">&quot;Long Russian novel&quot;</span>
    <span style="color:#9966CC; font-weight:bold;">When</span> I press <span style="color:#996600;">&quot;Create&quot;</span>
    <span style="color:#9966CC; font-weight:bold;">Then</span> I should be on the book list page
    <span style="color:#9966CC; font-weight:bold;">And</span> I should see <span style="color:#996600;">&quot;War &amp; Peace&quot;</span></pre></div></div>

<p>Last time I ran it, it failed on the first line because it couldn't find the BooksController. This time, same location, but it says it can't find the view. So whiny! To placate it, I create an empty view called <code>new.html.erb</code> and run it again.</p>
<p>Now cucumber gets past line 1 (huzzah!!) and fails on line 2 (<code>And I fill in "Name" with "War &amp; Peace"</code>) with the message that it can't find a field called Name to fill in. So I add a standard rails form to the view.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&lt;%-</span> form_for <span style="color:#0066ff; font-weight:bold;">@book</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;">label</span> <span style="color:#ff3333; font-weight:bold;">:name</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;">:name</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;">:description</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_area</span> <span style="color:#ff3333; font-weight:bold;">:description</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;Create&quot;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
<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></div></div>

<p>Uh oh. Cucumber is mad at me because there is no <code>@book</code> object. Back to rspec for me!</p>
<h2>rspec: The Return</h2>
<p>In my controller's <code>new</code> method, I need to create a book object that the form will use. I first add a test for that in the controller spec:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><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;">join</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:#996600;">'..'</span>, <span style="color:#996600;">'spec_helper.rb'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
describe BooksController <span style="color:#9966CC; font-weight:bold;">do</span>
  describe <span style="color:#996600;">&quot;#new&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    before <span style="color:#9966CC; font-weight:bold;">do</span>
      get <span style="color:#ff3333; font-weight:bold;">:new</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
    it <span style="color:#996600;">&quot;should be successful&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      response.<span style="color:#9900CC;">should</span> be_success
    <span style="color:#9966CC; font-weight:bold;">end</span>
    it <span style="color:#996600;">&quot;should create a book object&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      assigns<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:book</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">should_not</span> be_nil
    <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></div></div>

<p>This fails the right way - it says assigns(:book) is nil. So then I add the creation of the book object to the controller.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> BooksController <span style="color:#006600; font-weight:bold;">&lt;</span> ApplicationController
  <span style="color:#9966CC; font-weight:bold;">def</span> new
    <span style="color:#0066ff; font-weight:bold;">@book</span> = Book.<span style="color:#9900CC;">new</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Now the spec fails, saying it can't find the Book class. It has a point - I haven't created the model yet. Fixed:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Book <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;">end</span></pre></div></div>

<p>Now it fails saying it can't find the books table. So I write a migration that creates that.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> CreateBooksTable <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Migration</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">up</span>
    create_table <span style="color:#ff3333; font-weight:bold;">:books</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>t<span style="color:#006600; font-weight:bold;">|</span>
      t.<span style="color:#CC0066; font-weight:bold;">string</span> <span style="color:#ff3333; font-weight:bold;">:name</span>
      t.<span style="color:#9900CC;">text</span> <span style="color:#ff3333; font-weight:bold;">:description</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;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">down</span>
    drop_table <span style="color:#ff3333; font-weight:bold;">:books</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Once I do <code>rake db:migrate</code> and <code>rake db:test:prepare</code>, I re-run my controller spec....and it passes! Back to the cucumber feature!</p>
<h2>Cucumber...again.</h2>
<p>In our last episode, cucumber was visibly annoyed because there was no <code>@book</code> object for the form to operate on. I run it again to see if it's still sulking.</p>
<p>Yep. This time it tells me that it can't find books_path. <code>form_for</code> tries to submit to the create path by default, which I haven't added yet. I add it to the routes.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  map.<span style="color:#9900CC;">resources</span> <span style="color:#ff3333; font-weight:bold;">:books</span>, <span style="color:#ff3333; font-weight:bold;">:only</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:new</span>, <span style="color:#ff3333; font-weight:bold;">:create</span><span style="color:#006600; font-weight:bold;">&#93;</span></pre></div></div>

<p>This time, when I run cucumber, it gets through the first three lines (woo hoo!) and fails on the 4th, saying no action responded to create. Back to the rspec-cave, batman!</p>
<h2>rspec: The Sequel to The Return</h2>
<p>I add a controller spec for the <code>create</code> method.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  describe <span style="color:#996600;">&quot;#create&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    it <span style="color:#996600;">&quot;should create a new book&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      post <span style="color:#ff3333; font-weight:bold;">:create</span>, <span style="color:#996600;">&quot;book&quot;</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#996600;">&quot;name&quot;</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;Jane Eyre&quot;</span>, <span style="color:#996600;">&quot;description&quot;</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;Something Victorian&quot;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
      assigns<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:book</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">should_not</span> be_nil
      assigns<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:book</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">name</span>.<span style="color:#9900CC;">should</span> == <span style="color:#996600;">&quot;Jane Eyre&quot;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>When I run it, I get the same message as in cucumber: no action responded to create. So I create the create:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> BooksController <span style="color:#006600; font-weight:bold;">&lt;</span> ApplicationController
  <span style="color:#9966CC; font-weight:bold;">def</span> new
    <span style="color:#0066ff; font-weight:bold;">@book</span> = Book.<span style="color:#9900CC;">new</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> create
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Now when I re-run the spec, it fails saying that assigns(:book) is nil, which makes sense. I put in the guts of <code>create</code> to make that pass.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  <span style="color:#9966CC; font-weight:bold;">def</span> create
    <span style="color:#0066ff; font-weight:bold;">@book</span> = Book.<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;">:book</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0066ff; font-weight:bold;">@book</span>.<span style="color:#9900CC;">save</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Now rspec passes! Back to cucumber. </p>
<h2>So...cucumber. We meet again.</h2>
<p>When I re-run the feature, it says I'm missing a template for create, which is correct. However, in this case, I don't want to make a template for create - I want to redirect to the book list page. So once again, I'm back with rspec.</p>
<h2>rspec: Back so soon?</h2>
<p>I add that expectation to the controller spec for <code>create</code>.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">    it <span style="color:#996600;">&quot;should redirect to the book list page&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      response.<span style="color:#9900CC;">should</span> redirect_to books_path
    <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>It fails saying there's no redirect. So to make it pass, I add a redirect to the controller code.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  <span style="color:#9966CC; font-weight:bold;">def</span> create
    <span style="color:#0066ff; font-weight:bold;">@book</span> = Book.<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;">:book</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;">@book</span>.<span style="color:#9900CC;">save</span>
      redirect_to books_path
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Now my controller specs pass. Cucumber, I'm coming for you!</p>
<h2>Oh, you again.</h2>
<p>Last time, we got through the first 3 lines of the feature and failed on line 4 (<code>When I press "Create"</code>). When I run it this time, it gets through the same 3 lines and then fails in the same place again, saying that no action responded to index. I add <code>index</code> to the routes.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  map.<span style="color:#9900CC;">resources</span> <span style="color:#ff3333; font-weight:bold;">:books</span>, <span style="color:#ff3333; font-weight:bold;">:only</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:new</span>, <span style="color:#ff3333; font-weight:bold;">:create</span>, <span style="color:#ff3333; font-weight:bold;">:index</span><span style="color:#006600; font-weight:bold;">&#93;</span></pre></div></div>

<p>I re-run the feature and get the same error message. WTF, cucumber?! It turns out that rails' implementation of REST uses the same path helper for create and index, so the path helper for <code>index</code> already exists, even though the method does not. A little strange, I know. But we need an <code>index</code> method, so it's back to rspec.</p>
<h2>rspec: For the first time, for the last time...</h2>
<p>I write a spec for the <code>index</code> method.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  describe <span style="color:#996600;">&quot;#index&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    it <span style="color:#996600;">&quot;should be successful&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      get <span style="color:#ff3333; font-weight:bold;">:index</span>
      response.<span style="color:#9900CC;">should</span> be_success
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>I still get no action responded to index. So l add the method in BooksController, empty to start.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  <span style="color:#9966CC; font-weight:bold;">def</span> index
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Specs pass, back to cucumber!</p>
<h2>How can I miss you if you won't go away?</h2>
<p>Cucumber tells me there's no template for index. So I create an empty one, and re-run. This run, for the first time, I pass line 4 (yaaaaay) but then it fails on line 5 (<code>Then I should be on the book list page</code>) because it can't figure out what I mean by "the book list page." That goes in the cucumber path helper.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">    <span style="color:#9966CC; font-weight:bold;">when</span> <span style="color:#006600; font-weight:bold;">/</span>the book list page<span style="color:#006600; font-weight:bold;">/</span>
      books_path</pre></div></div>

<p>OMG five out of six steps pass! Now cucumber says it can't find "War &amp; Peace" on the page, so let's make the index view list the existing books. Back to rspec...</p>
<h2>Don't go away mad...just go away.</h2>
<p>I add the following <code>it</code> block to the spec for <code>index</code>.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">    it <span style="color:#996600;">&quot;should assign a list of existing books&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      Book.<span style="color:#9900CC;">create</span>!<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;Endymion&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:description</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;weird&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      get <span style="color:#ff3333; font-weight:bold;">:index</span>
      assigns<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:books</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">should_not</span> be_nil
      assigns<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:books</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">length</span>.<span style="color:#9900CC;">should</span> == <span style="color:#006666;">1</span>
    <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>It fails because I'm not creating @books in the controller, so I fix that.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  <span style="color:#9966CC; font-weight:bold;">def</span> index
    <span style="color:#0066ff; font-weight:bold;">@books</span> = Book.<span style="color:#9900CC;">all</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Now the specs pass - back to cucumber. </p>
<h2>We really have to stop seeing each other like this.</h2>
<p>Cucumber still says it can't find War &amp; Peace, because I haven't added printing out the books to the index view. I'll fix that.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&lt;%-</span> <span style="color:#0066ff; font-weight:bold;">@books</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>book<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#006600; font-weight:bold;">-%&gt;</span>
    &lt;strong&gt;<span style="color:#006600; font-weight:bold;">&lt;%</span>= h book.<span style="color:#9900CC;">name</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;/strong&gt;
    <span style="color:#006600; font-weight:bold;">&lt;%</span>= h book.<span style="color:#9900CC;">description</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
<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></div></div>

<p>Re-run cucumber and ... ta-da! The feature passes! I've done everything I need to call the story done. I have the minimum amount of code I need, because all the code I wrote was driven by the feature. Story: <strong>delivered</strong>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sarahmei.com/blog/2010/05/29/outside-in-bdd/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Another Ruby hack night!</title>
		<link>http://www.sarahmei.com/blog/2010/05/22/ruby-hack-night-61/</link>
		<comments>http://www.sarahmei.com/blog/2010/05/22/ruby-hack-night-61/#comments</comments>
		<pubDate>Sat, 22 May 2010 22:02:43 +0000</pubDate>
		<dc:creator>sarahmei</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[pivotal]]></category>
		<category><![CDATA[sfruby]]></category>

		<guid isPermaLink="false">http://www.sarahmei.com/blog/?p=436</guid>
		<description><![CDATA[I&#8217;ll be hosting another Ruby hack night on Tuesday, June 1st, at Pivotal Labs &#8211; 731 Market St, between 3rd and 4th in San Francisco. You can RSVP here.
You&#8217;re welcome to bring any sort of Ruby-related project! The theme for the evening is Javascript testing, following on this month&#8217;s monthly meetup. But I won&#8217;t make [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ll be hosting another Ruby hack night on Tuesday, June 1st, at Pivotal Labs &#8211; 731 Market St, between 3rd and 4th in San Francisco. You can RSVP <a href="http://www.meetup.com/sfruby/calendar/13534634/">here</a>.</p>
<p>You&#8217;re welcome to bring any sort of Ruby-related project! The theme for the evening is Javascript testing, following on <a href="http://www.meetup.com/sfruby/calendar/13060368/">this month&#8217;s monthly meetup</a>. But I won&#8217;t make you write any Javascript if you don&#8217;t want to.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sarahmei.com/blog/2010/05/22/ruby-hack-night-61/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby hack night</title>
		<link>http://www.sarahmei.com/blog/2010/04/21/ruby-hack-night/</link>
		<comments>http://www.sarahmei.com/blog/2010/04/21/ruby-hack-night/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 03:09:26 +0000</pubDate>
		<dc:creator>sarahmei</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[pivotal]]></category>
		<category><![CDATA[sfruby]]></category>

		<guid isPermaLink="false">http://www.sarahmei.com/blog/?p=420</guid>
		<description><![CDATA[
The peninsula has all kinds of neat hack events like SuperHappyDevHouse and various Hacker Dojo events. But I hate driving all the way down there just to hang out with hackers and get something done on a project. There are plenty of hackers in San Francisco. There might even be more of the type of [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://maps.google.com/maps?f=q&#038;source=s_q&#038;hl=en&#038;geocode=&#038;q=731+Market+Street,+San+Francisco,+CA&#038;sll=37.781689,-122.391061&#038;sspn=0.009158,0.019205&#038;ie=UTF8&#038;hq=&#038;hnear=731+Market+St,+San+Francisco,+California+94103&#038;ll=37.786877,-122.404368&#038;spn=0.009157,0.019205&#038;z=16"><img src="/blog/wp-content/uploads/2010/04/731_market_st.jpg" alt="Pivotal Labs, 731 Market St, 3rd Floor" title="731_market_st" width="424" height="349" class="alignright size-full wp-image-537" /></a></p>
<p>The peninsula has all kinds of neat hack events like <a href="http://superhappydevhouse.org">SuperHappyDevHouse</a> and various <a href="http://hackerdojo.org">Hacker Dojo</a> events. But I hate driving all the way down there just to hang out with hackers and get something done on a project. There are plenty of hackers in San Francisco. There might even be <strong>more</strong> of the type of hackers I want to hang out with.</p>
<p>So I&#8217;ve decided to host a monthly hack night, to be held on the Tuesday following the monthly SF Ruby meetup. My employer, <a href="http://pivotallabs.com">Pivotal Labs</a>, has graciously volunteered their space. Since tonight is the SF Ruby meetup, the next hack night is <strong>next Tuesday</strong>, April 27th, from 7-9:30 (ish).</p>
<p><a href="http://bit.ly/dx3t9T">RSVP now!</a> See you next Tuesday.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sarahmei.com/blog/2010/04/21/ruby-hack-night/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SCALE 8x Slides Posted</title>
		<link>http://www.sarahmei.com/blog/2010/02/20/scale-8x-slides-posted/</link>
		<comments>http://www.sarahmei.com/blog/2010/02/20/scale-8x-slides-posted/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 00:07:13 +0000</pubDate>
		<dc:creator>sarahmei</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[scale8x]]></category>
		<category><![CDATA[sfruby]]></category>

		<guid isPermaLink="false">http://www.sarahmei.com/blog/?p=326</guid>
		<description><![CDATA[Yesterday I did a talk at SCALE 8x called &#8220;Moving the Needle: How SF Ruby Got to 18%.&#8221; Broadly, the topic was how to get more women into a technical community. I talked about how, specifically, we took the SF Ruby monthly meetups from 2% women to 18% women over the past year.
Short version: it [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I did a talk at <a href="http://www.socallinuxexpo.org/scale8x/">SCALE 8x</a> called &#8220;<a href="http://www.socallinuxexpo.org/scale8x/presentations/moving-needle-how-san-francisco-ruby-community-got-18">Moving the Needle: How SF Ruby Got to 18%</a>.&#8221; Broadly, the topic was how to get more women into a technical community. I talked about how, specifically, we took the <a href="http://meetup.com/sfruby">SF Ruby</a> monthly meetups from 2% women to 18% women over the past year.</p>
<p>Short version: it was a lot of work.<br />
<span id="more-326"></span><br />
A lot of people have asked us about this, though, so it seemed worth distilling. The slides don&#8217;t convey everything I talked about. In the next few weeks I&#8217;d like to try putting together a blog post that does a better job. But for now, here they are.</p>
<p><strong>Update (3/6/2010):</strong> <a href="http://audio.socallinuxexpo.org/Friday/WIOS/talk%20%235%20(Sarah%20Mei).mp3">MP3 audio is now available</a> &#8211; thanks SCALE folks! Also, I&#8217;ve posted a <a href="http://www.sarahmei.com/blog/wp-content/uploads/2010/03/SCALE-WIOS.pdf">PDF version of the slides</a> for those of you without flash.</p>
<div style="width:425px;text-align:left;padding-left:20px;" id="__ss_3234356"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/sarahmei/moving-the-needle-how-sf-ruby-got-to-18" title="Moving the Needle: How SF Ruby Got to 18%">Moving the Needle: How SF Ruby Got to 18%</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=scale-wios-100220162111-phpapp02&#038;stripped_title=moving-the-needle-how-sf-ruby-got-to-18" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=scale-wios-100220162111-phpapp02&#038;stripped_title=moving-the-needle-how-sf-ruby-got-to-18" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more presentations from <a style="text-decoration:underline;" href="http://www.slideshare.net/sarahmei">Sarah Mei</a>.</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sarahmei.com/blog/2010/02/20/scale-8x-slides-posted/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>LARubyConf Slides Posted</title>
		<link>http://www.sarahmei.com/blog/2010/02/20/larubyconf-slides-posted/</link>
		<comments>http://www.sarahmei.com/blog/2010/02/20/larubyconf-slides-posted/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 21:39:55 +0000</pubDate>
		<dc:creator>sarahmei</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[larubyconf]]></category>
		<category><![CDATA[teaching]]></category>
		<category><![CDATA[workshops]]></category>

		<guid isPermaLink="false">http://www.sarahmei.com/blog/?p=309</guid>
		<description><![CDATA[Just finished my LA Ruby Conf talk on teaching Ruby to kids. Here are a few further resources:


Shoes &#8211; a simple way to create desktop applications in Ruby. Cross-platform, pure awesome. (code on github)
Hackety Hack &#8211; built on Shoes, this is a toolkit specifically for learning how to program.
Small Ruby &#8211; learn to program for [...]]]></description>
			<content:encoded><![CDATA[<p>Just finished my LA Ruby Conf talk on teaching Ruby to kids. Here are a few further resources:<br />
<span id="more-309"></span></p>
<ul>
<li><a href="http://shoes.heroku.com/">Shoes</a> &#8211; a simple way to create desktop applications in Ruby. Cross-platform, pure awesome. (<a href="http://github.com/shoes/shoes">code on github</a>)</li>
<li><a href="http://hacketyhack.heroku.com/">Hackety Hack</a> &#8211; built on Shoes, this is a toolkit specifically for learning how to program.</li>
<li>Small Ruby &#8211; learn to program for the smaller set &#8211; think turtle drawing. Coming soon.</li>
<li><a href="http://www.sarahmei.com/blog/wp-content/uploads/2010/03/LARubyConf.pdf">PDF version of the slides</a> (exactly the same as slides below)</li>
</ul>
<div style="width:425px;text-align:left;padding-left:15px;" id="__ss_3233891"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/sarahmei/teaching-ruby-to-kids" title="Teaching Ruby to Kids">Teaching Ruby to Kids</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=larubyconf-100220140747-phpapp01&#038;stripped_title=teaching-ruby-to-kids" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=larubyconf-100220140747-phpapp01&#038;stripped_title=teaching-ruby-to-kids" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more presentations from <a style="text-decoration:underline;" href="http://www.slideshare.net/sarahmei">Sarah Mei</a>.</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sarahmei.com/blog/2010/02/20/larubyconf-slides-posted/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The First 2010 Ruby Outreach Workshop</title>
		<link>http://www.sarahmei.com/blog/2010/02/19/the-first-2010-ruby-outreach-workshop/</link>
		<comments>http://www.sarahmei.com/blog/2010/02/19/the-first-2010-ruby-outreach-workshop/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 17:37:54 +0000</pubDate>
		<dc:creator>sarahmei</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[childcare]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[sfruby]]></category>
		<category><![CDATA[workshops]]></category>

		<guid isPermaLink="false">http://www.sarahmei.com/blog/?p=301</guid>
		<description><![CDATA[&#8230;is now open for registration.  Last year Sarah Allen and I did three workshops for women and this year we&#8217;re going for four.  So, if you&#8217;d like to learn Rails and can come BOTH Friday, February 26th in the evening AND Saturday, February 27th during the day, go sign up! There are only [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_171" class="wp-caption alignright" style="width: 210px"><img src="http://www.sarahmei.com/blog/wp-content/uploads/2009/07/ruby.jpg" alt="Copyright 2006 by Yukihiro Matsumoto" title="ruby" width="200" class="size-full wp-image-171" /><p class="wp-caption-text">LEARN ME</p></div>
<p>&#8230;is now <a href="http://www.meetup.com/sfruby/calendar/12605445/">open for registration</a>.  Last year <a href="http://ultrasaurus.com">Sarah Allen</a> and I did three workshops for women and this year we&#8217;re going for four.  So, if you&#8217;d like to learn Rails and can come BOTH Friday, February 26th in the evening AND Saturday, February 27th during the day, <a href="http://www.meetup.com/sfruby/calendar/12605445/">go sign up</a>! There are only a few spots left.</p>
<p>And yep, still free.</p>
<p>We&#8217;re also seeking Rails developers (of any gender) to assist as TAs. <a href="http://www.meetup.com/sfruby/calendar/12605400/">Tell us about that here</a>.  Past TAs and teachers have found it quite rewarding. Plus you get a drink ticket for the afterparty. <img src='http://www.sarahmei.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>And finally, some logistics: it&#8217;ll be in an office space in downtown San Francisco, near transit. Next week we&#8217;ll send out the exact address. We&#8217;ll have informal childcare and space for pumping or nursing &#8211; please tell us if you think you&#8217;ll be using those services when you register.</p>
<p>See you there! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.sarahmei.com/blog/2010/02/19/the-first-2010-ruby-outreach-workshop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Travails with readline</title>
		<link>http://www.sarahmei.com/blog/2010/01/08/travails-with-readlin/</link>
		<comments>http://www.sarahmei.com/blog/2010/01/08/travails-with-readlin/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 03:59:05 +0000</pubDate>
		<dc:creator>sarahmei</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[irb]]></category>
		<category><![CDATA[japanese]]></category>
		<category><![CDATA[readline]]></category>
		<category><![CDATA[rtranslate]]></category>

		<guid isPermaLink="false">http://www.sarahmei.com/blog/?p=239</guid>
		<description><![CDATA[Applies to: Ruby 1.8.7, compiled from source, on OS X 10.6 (Snow Leopard).
I&#8217;ve been working on a side project that deals with Japanese text in Ruby. I installed rtranslate, a gem that gives me programmatic access to Google Translate. I wanted to try it out in irb.
>> require 'rtranslate'
=> true
So far so good.

>> Translate.t("

Here&#8217;s where [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Applies to:</strong> Ruby 1.8.7, compiled from source, on OS X 10.6 (Snow Leopard).</p>
<p>I&#8217;ve been working on a side project that deals with Japanese text in Ruby. I installed <a href="http://github.com/sishen/rtranslate">rtranslate</a>, a gem that gives me programmatic access to Google Translate. I wanted to try it out in irb.</p>
<p><code>>> require 'rtranslate'<br />
=> true</code></p>
<p>So far so good.<br />
<code><br />
>> Translate.t("<br />
</code><br />
Here&#8217;s where I started to run into problems. I changed the input mode to Japanese and tried to enter はい (hai). All I got was beeping &#8211; irb wouldn&#8217;t let me enter any Japanese characters at all. I tried pasting from somewhere else &#8211; also a no go. </p>
<p>Long story short: by default, Ruby links against <a href="http://thrysoee.dk/editline/">editline</a> instead of GNU <a href="http://tiswww.case.edu/php/chet/readline/rltop.html">readline</a>, and editline doesn&#8217;t support multi-byte characters. If I started irb with the &#8211;noreadline option, it worked fine, but then none of the arrow keys worked. Highly annoying. </p>
<p>I read five different articles [<a href="http://www.jorgebernal.info/development/fixing-snow-leopard-ruby-readline">1</a>] [<a href="http://blogs.law.harvard.edu/hoanga/2009/09/08/getting-ruby-191p243-to-work-on-os-x-1058-with-japanese-input-support-on-irb/">2</a>] [<a href="http://wonko.com/post/how-to-compile-ruby-191">3</a>] [<a href="http://henrik.nyh.se/2008/03/irb-readline">4</a>] [<a href="http://www.michaelhamrah.com/blog/index.php/2009/12/getting-ruby-1-9-readline-rails-and-mysql-all-running-on-snow-leopard/">5</a>] that fixed variants of the problem; none of the solutions worked fully for me. My machine is running Snow Leopard, and I had installed Ruby 1.8.7 from source following the <a href="http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard/">Hivelogic directions</a>. So if you&#8217;re in the same boat, here&#8217;s how you get multi-byte input working:</p>
<p>1. Install GNU readline.</p>
<p><code>cd ~/src<br />
curl -O ftp://ftp.gnu.org/gnu/readline/readline-6.0.tar.gz<br />
tar xzvf readline-6.0.tar.gz<br />
cd readline-6.0<br />
./configure --prefix=/usr/local<br />
make<br />
sudo make install<br />
</code></p>
<p>The &#8211;prefix in the configure line is crucial.</p>
<p>2. Recompile Ruby, pointing at the new readline. I still had the Ruby source directory in ~/src from when I compiled it the first time (this is a relatively new laptop). If you don&#8217;t, you can just download it again.</p>
<p><code>cd ~/src<br />
curl -O ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p174.tar.gz<br />
tar xzvf ruby-1.8.7-p174.tar.gz<br />
cd ruby-1.8.7-p174<br />
make clean<br />
autoconf<br />
./configure --enable-shared --with-readline-dir=/usr/local<br />
make<br />
sudo make install<br />
</code></p>
<p>3. My profile had gotten out of whack, so I had to add this line (again) to ~/.bash_profile:</p>
<p><code>export PATH=/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH<br />
</code></p>
<p>Now I can enter multi-byte characters into irb, or copy them in from elsewhere. Now I can get on with what I was actually going to do. <img src='http://www.sarahmei.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><code>>> require "rtranslate"<br />
=> true<br />
>> Translate.t("はい", "JAPANESE", "ENGLISH")<br />
=> "Yes"<br />
</code> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.sarahmei.com/blog/2010/01/08/travails-with-readlin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>July/August Ruby workshop registration open!</title>
		<link>http://www.sarahmei.com/blog/2009/07/06/julyaugust-ruby-workshop-registration-open/</link>
		<comments>http://www.sarahmei.com/blog/2009/07/06/julyaugust-ruby-workshop-registration-open/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 04:02:11 +0000</pubDate>
		<dc:creator>sarahmei</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[pivotal]]></category>
		<category><![CDATA[sfruby]]></category>
		<category><![CDATA[workshops]]></category>

		<guid isPermaLink="false">http://www.sarahmei.com/blog/?p=166</guid>
		<description><![CDATA[Registration is now open for the free Ruby workshop for women that Sarah Allen and I are running at the end of July. Please RSVP soon &#8211; the last workshop filled up less than 3 days after registration opened.
This is a two-day event open to total programming novices, system administrators, and developers in other languages. [...]]]></description>
			<content:encoded><![CDATA[<p>Registration is now open for the free Ruby workshop for women that Sarah Allen and I are running at the end of July. Please RSVP soon &#8211; the last workshop filled up less than 3 days after registration opened.</p>
<div id="attachment_171" class="wp-caption alignright" style="width: 210px"><img src="http://www.sarahmei.com/blog/wp-content/uploads/2009/07/ruby.jpg" alt="Copyright 2006 by Yukihiro Matsumoto" title="ruby" width="200" class="size-full wp-image-171" /><p class="wp-caption-text">LEARN ME</p></div>
<p>This is a two-day event open to total programming novices, system administrators, and developers in other languages. In other words &#8211; everyone! All the details are on the meetup pages.</p>
<p>RSVP yes for <strong>both </strong>Friday and Saturday to reserve your spot.<br />
<strong>Day 1, Friday 7/31:</strong> <a href="http://www.meetup.com/sfruby/calendar/10804417">http://www.meetup.com/sfruby/calendar/10804417</a><br />
<strong>Day 2, Saturday 8/1:</strong> <a href="http://www.meetup.com/sfruby/calendar/10804438">http://www.meetup.com/sfruby/calendar/10804438</a></p>
<p>As before, men are welcome to register as the +1 of a woman doing the workshop. So guys, I know there&#8217;s a woman somewhere in your life who you&#8217;ve always thought would make a great programmer. Recruit her and you can come along too. </p>
<p>The workshop includes dinner on Friday, and breakfast and lunch on Saturday. Child care and private space for nursing and/or pumping are available. Partners are welcome to stay with the kids but that&#8217;s not required.</p>
<p>We are looking for experienced Rails developers of all genders to volunteer at the event. This time we have a separate volunteer coordinator so that things run more smoothly. Volunteering will be fun and educational, plus it&#8217;ll be a great networking opportunity. <img src='http://www.sarahmei.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Stay tuned for info on how to get on the volunteer list.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sarahmei.com/blog/2009/07/06/julyaugust-ruby-workshop-registration-open/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>August Workshop Dates Confirmed!</title>
		<link>http://www.sarahmei.com/blog/2009/06/28/august-workshop-dates-confirmed/</link>
		<comments>http://www.sarahmei.com/blog/2009/06/28/august-workshop-dates-confirmed/#comments</comments>
		<pubDate>Sun, 28 Jun 2009 23:06:29 +0000</pubDate>
		<dc:creator>sarahmei</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[pivotal]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[sfruby]]></category>
		<category><![CDATA[workshops]]></category>

		<guid isPermaLink="false">http://www.sarahmei.com/blog/?p=145</guid>
		<description><![CDATA[Pivotal Labs will be hosting our next workshop on July 31st and August 1st &#8211; that&#8217;s Friday evening and Saturday all day.
The format will be similar to our first workshop: Friday night is a mixer and installfest. Attendees bring their laptops, and, with the help of our volunteers, install anything they&#8217;re missing to run Rails. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://pivotallabs.com/">Pivotal Labs</a> will be hosting our next workshop on <strong>July 31st and August 1st</strong> &#8211; that&#8217;s Friday evening and Saturday all day.</p>
<p>The format will be similar to our first workshop: Friday night is a mixer and installfest. Attendees bring their laptops, and, with the help of our volunteers, install anything they&#8217;re missing to run Rails. Saturday is the workshop itself, starting with a short general presentation at 10am. Then we&#8217;ll break into smaller groups for the workshop itself. Lunch is included, and child care and nursing/pumping space is available.</p>
<p>If you came to the first workshop, you&#8217;re welcome to return for this one! Newcomers are likewise encouraged to register. When you register, you&#8217;ll be asked to answer some questions that will help us figure out how to allocate the class space we have.</p>
<p>The June event generated some great word-of-mouth, so I&#8217;m expecting this one to fill up quickly once registration is open. To find out when you can register, watch this space, check out the new site <a href="http://sfrubyworkshops.com">sfrubyworkshops.com</a>, and join the low-traffic announcement-only mailing list (hosted by Google):</p>
<table style="padding: 5px; background-color: #ffffff;" border="0" cellspacing="0">
<form action="http://groups.google.com/group/sf-ruby-workshop-announce/boxsubscribe">
<tbody>
<tr>
<td style="padding-left: 5px;">Email address:</td>
<td style="padding-left: 5px;">
<input name="email" type="text" />
<input name="sub" type="submit" value="Subscribe" /></td>
</tr>
</tbody>
</form>
</table>
<p>Lastly, we&#8217;re looking for sponsors to help us make this event fantastic. If your company or organization would like to assist, please email rubyworkshop at gmail dot com, which goes to both me and Sarah Allen.</p>
<p>UPDATE: The fine folks at <a href="http://www.engineyard.com/">Engine Yard</a> are buying lunch. Thanks EY!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sarahmei.com/blog/2009/06/28/august-workshop-dates-confirmed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
