<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>Tom ten Thij's homepage - Home</title>
  <id>tag:tomtenthij.co.uk,2008:mephisto/</id>
  <generator version="0.7.3" uri="http://mephistoblog.com">Mephisto Noh-Varr</generator>
  <link href="http://tomtenthij.co.uk/feed/feed.xml" rel="self" type="application/atom+xml"/>
  <link href="http://tomtenthij.co.uk/" rel="alternate" type="text/html"/>
  <updated>2008-05-02T15:03:06Z</updated>
  <entry xml:base="http://tomtenthij.co.uk/">
    <author>
      <name>admin</name>
    </author>
    <id>tag:tomtenthij.co.uk,2008-05-02:64</id>
    <published>2008-05-02T14:59:00Z</published>
    <updated>2008-05-02T15:03:06Z</updated>
    <link href="http://tomtenthij.co.uk/2008/5/2/rails-team-for-hire" rel="alternate" type="text/html"/>
    <title>Rails team for hire</title>
<content type="html">
            &lt;p&gt;Working for Naked was a blast, but unfortunately the time has come to move on. We felt as the dev team that we were working rather well together and are therefore offering ourselves for hire as a complete team, seasoned in all aspects of developing a project on Rails.&lt;/p&gt;

&lt;p&gt;Feel free to contact me or any of its members informally if you may be interested.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.workingwithrails.com/group/8792-an-entire-rails-team-for-hire&quot;&gt;http://www.workingwithrails.com/group/8792-an-entire-rails-team-for-hire&lt;/a&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://tomtenthij.co.uk/">
    <author>
      <name>admin</name>
    </author>
    <id>tag:tomtenthij.co.uk,2008-04-29:57</id>
    <published>2008-04-29T09:56:00Z</published>
    <updated>2008-05-01T00:02:40Z</updated>
    <link href="http://tomtenthij.co.uk/2008/4/29/pimping-emacs-rails-mode" rel="alternate" type="text/html"/>
    <title>Pimping emacs rails mode</title>
<content type="html">
            &lt;p&gt;Steve Yegge's &lt;a href=&quot;http://steve-yegge.blogspot.com/2008/04/xemacs-is-dead-long-live-xemacs.html&quot;&gt;inspiring Emacs post&lt;/a&gt; has urged me to finally get my ass in gear and get some work done on maintaining the Rails on Emacs mode.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;&quot;&gt;current emacs-rails mode&lt;/a&gt; is available from Rubyforge and I have cloned the current version of it to  github at &lt;a href=&quot;http://github.com/tomtt/emacs-rails&quot;&gt;http://github.com/tomtt/emacs-rails&lt;/a&gt;. 
The github wiki has a braindump with &quot;things i want from my rails mode&quot;. This may contain things that are already working but I will find that out as I go along :).&lt;/p&gt;

&lt;p&gt;My plan is to have the github version be just how I like my mode, but I will push some of the things that work back into the official repository. I intend for Rubyforge to remain the authoritative site for tickets.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://tomtenthij.co.uk/">
    <author>
      <name>tomtt</name>
    </author>
    <id>tag:tomtenthij.co.uk,2008-02-12:18</id>
    <published>2008-02-12T19:49:00Z</published>
    <updated>2008-04-11T09:55:14Z</updated>
    <link href="http://tomtenthij.co.uk/2008/2/12/rails-schema-browser-plugin-proof-of-concept" rel="alternate" type="text/html"/>
    <title>Rails schema browser plugin: proof of concept</title>
<content type="html">
            &lt;p&gt;&lt;a href=&quot;/images/stuff/lovdbyless_schema.png&quot;&gt;&lt;img src=&quot;/images/stuff/lovdbyless_schema.png&quot; height=&quot;200px&quot; /&gt;&lt;/a&gt;
I have just created my first rails plugin which is a proof of concept
interactive graphical viewer for your database schema and relations. It is still
very rough around the edges and I have not had as much time as I hoped due to starting a great job at &lt;a href=&quot;http://getnkd.com/&quot;&gt;Naked&lt;/a&gt;. I'm expecting to make some time for this soon though.&lt;/p&gt;

&lt;p&gt;For an example of what you might expect see &lt;a href=&quot;/schema_browser&quot;&gt;the schema browser of my own mephisto
blog&lt;/a&gt;. Tables are drawn based on the tables defined in the current database and relations based on the belongs_to relations defined in the models.&lt;/p&gt;

&lt;p&gt;Installing the schema_browser plugin:&lt;/p&gt;
&lt;pre&gt;
cd yourapp/vendor/plugins
git clone git://github.com/tomtt/schema-browser.git
cd ../../
./script/generate schema_browser
&lt;/pre&gt;

&lt;p&gt;Things may work for you this way, but it is also totally possible that
you will have to add corresponding routes to config/routes.rb:&lt;/p&gt;
&lt;pre&gt;
  map.connect 'schema_browser', :controller =&gt; &quot;schema_browser&quot;
  map.connect 'schema_browser/schema', :controller =&gt; &quot;schema_browser&quot;, :action =&gt; &quot;schema&quot;
&lt;/pre&gt;&lt;p&gt;
If you have to do this, you may also have to restart your server.
&lt;/p&gt;

&lt;p&gt;The schema browser is now available at http://yoursite.com/schema_browser. Note that currently this would be shown in production as well which may not be something you want. Disabling the
schema browser in production is one of many future plans for this
plugin.&lt;br /&gt;

The xml representation is available at
http://yoursite.com/schema_browser/schema&lt;/p&gt;

&lt;p&gt;The javascript code to view this was taken from &lt;a href=&quot;http://ondras.zarovi.cz/sql/&quot;&gt;http://ondras.zarovi.cz/sql/&lt;/a&gt; which is an amazing piece of work.&lt;/p&gt;

&lt;p&gt;I'd be interested to hear if it is possible to serve up a git repos
as if it were an svn repos so that script/plugin install would still
work.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://tomtenthij.co.uk/">
    <author>
      <name>tomtt</name>
    </author>
    <id>tag:tomtenthij.co.uk,2008-02-01:16</id>
    <published>2008-02-01T06:41:00Z</published>
    <updated>2008-02-01T06:42:29Z</updated>
    <link href="http://tomtenthij.co.uk/2008/2/1/real-programmers" rel="alternate" type="text/html"/>
    <title>Real programmers</title>
<content type="html">
            &lt;p&gt;If you have geeky personal tendencies, you should know about &lt;a href=&quot;http://xkcd.com&quot;&gt;xkcd&lt;/a&gt;. Here's a recent &lt;a href=&quot;http://xkcd.com/378/&quot;&gt;strip featuring my favourite editor&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;By the way, xkcd mouse overs are the funniest bit sometimes, but &lt;a href=&quot;http://www.mozilla.com/firefox/&quot;&gt;firefox&lt;/a&gt; does not show them out of the box. Fortunately this is fixed by the &lt;a href=&quot;https://addons.mozilla.org/firefox/1715/&quot;&gt;Long Titles extension&lt;/a&gt;.
          </content>  </entry>
  <entry xml:base="http://tomtenthij.co.uk/">
    <author>
      <name>tomtt</name>
    </author>
    <id>tag:tomtenthij.co.uk,2008-01-25:13</id>
    <published>2008-01-25T14:10:00Z</published>
    <updated>2008-05-27T13:17:26Z</updated>
    <category term="rails"/>
    <category term="rspec"/>
    <category term="story_runner"/>
    <link href="http://tomtenthij.co.uk/2008/1/25/rspec-plain-text-story-runner-on-a-fresh-rails-app" rel="alternate" type="text/html"/>
    <title>RSpec plain text story runner on a fresh rails app</title>
<content type="html">
            &lt;p&gt;&lt;a href=&quot;http://rspec.info/&quot;&gt;RSpec&lt;/a&gt; is a wonderful Behaviour Driven Development
framework that is also very suitable for Rails applications. After
giving a talk on it for the Scotland Ruby usergroup I found that people are most impressed with its
plain text story runner feature. I have found documentation on this
rather meager so I created this post on how to setup a rails app
from scratch that has a story with some scenarios that all pass. Once I had this in place the rest was a piece of cake&lt;sup&gt;*&lt;/sup&gt;...&lt;/p&gt;

&lt;p&gt;To find out more about how the story runner works have a look at
the links at the bottom of this post. The peepcode on the issue is
good and between the posts by David Chelimsky - the creator of this stuff - there is
some useful information as well.&lt;p&gt;

&lt;p&gt;The central idea is to define each part of an acceptance test (given ... when ... then ...) as an English sentence. These sentences
are then defined as 'steps' which perform the corresponding action or
test. Once you have built up a decent library of steps a client can
have a good shot at writing his own acceptance tests. Any sentences that are not yet
covered by a step will show up as pending.&lt;/p&gt;

&lt;p&gt;On with the practical business!&lt;/p&gt;

&lt;p&gt;We do not need much of a rails app for us to be able to test it with a
story. I will just use a fresh rails install with the needed RSpec and restful_authentication plugins. Like so:
&lt;pre&gt;$ rails storyapp
$ cd storyapp
$ rake db:create:all # after setting up database.yml for your system
$ ./script/plugin install git://github.com/dchelimsky/rspec.git
$ ./script/plugin install git://github.com/dchelimsky/rspec-rails.git
$ ./script/generate rspec
$ ./script/plugin install git://github.com/technoweenie/restful-authentication.git
$ ./script/generate authenticated user
$ rake db:migrate
$ rake db:test:prepare&lt;/pre&gt;

Add the following snippet to your config/routes.db to define login/logout routes:
&lt;div class=&quot;CodeRay&quot;&gt;
  &lt;div class=&quot;code&quot;&gt;&lt;pre&gt;map.with_options &lt;span class=&quot;sy&quot;&gt;:controller&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;sessions&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; | page |
   page.login &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/login&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:action&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
   page.logout &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/logout&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:action&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;destroy&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;/p&gt;

&lt;p&gt;At this stage you should be able to start your rails server and
find a login form at &lt;a href=&quot;http://localhost:3000/login&quot;&gt;http://localhost:3000/login&lt;/a&gt;. Our
application behaves as follows: if you login with invalid credentials
(all of them are until a user is created) you will be shown the login
form again. If you create a user from &lt;a href=&quot;http://localhost:3000/users/new&quot;&gt;http://localhost:3000/users/new&lt;/a&gt;
this user will be created in the database and you will be redirected
to &quot;/&quot; (for now still showing the default rails page). So let's write
a story that tests this behaviour. First there is some more setting up to do though...&lt;p&gt;

&lt;p&gt;I am choosing the convention to name my text stories stories/foo_story and
the corresponding runner stories/foo_story.rb. All steps will be named
stories/steps/foo_steps.rb. My spec_helper will automatically require
all the step files in the stories/steps directory. This is how we set
this up:
&lt;pre&gt;$ mkdir stories/steps&lt;/pre&gt;
and add stuff to your stories/helper.rb so that it looks like this:
&lt;div class=&quot;CodeRay&quot;&gt;
  &lt;div class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;co&quot;&gt;ENV&lt;/span&gt;[&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;RAILS_ENV&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;] = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
require &lt;span class=&quot;co&quot;&gt;File&lt;/span&gt;.expand_path(&lt;span class=&quot;co&quot;&gt;File&lt;/span&gt;.dirname(&lt;span class=&quot;pc&quot;&gt;__FILE__&lt;/span&gt;) + &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/../config/environment&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)
require &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;spec/rails/story_adapter&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;
require &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;ruby-debug&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;

dir = &lt;span class=&quot;co&quot;&gt;File&lt;/span&gt;.dirname(&lt;span class=&quot;pc&quot;&gt;__FILE__&lt;/span&gt;)
&lt;span class=&quot;co&quot;&gt;Dir&lt;/span&gt;[&lt;span class=&quot;co&quot;&gt;File&lt;/span&gt;.expand_path(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;dir&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/steps/*.rb&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)].uniq.each &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; |file|
  require file
&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;##&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# Run a story file relative to the stories directory.&lt;/span&gt;

&lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;run_local_story&lt;/span&gt;(filename, options={})
  run &lt;span class=&quot;co&quot;&gt;File&lt;/span&gt;.join(&lt;span class=&quot;co&quot;&gt;File&lt;/span&gt;.dirname(&lt;span class=&quot;pc&quot;&gt;__FILE__&lt;/span&gt;), filename), options
&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;/p&gt;

&lt;p&gt;This is the story we will be using, so go ahead and save that as stories/login_story:
&lt;pre&gt;Story: User logging in

  As a user
  I want to login with my details
  So that I can get access to the site

  Scenario: User uses wrong password

    Given a username 'jdoe'
    And a password 'letmein'

    When the user logs in with username and password

    Then the login form should be shown again

  Scenario: Creates a new user

    Given a username 'jdoe'
    And a password 'letmein'
    And an email 'jdoe@test.com'
    And there is no user with this username

    When the user creates an account with username, password and email

    Then there should be a user named 'jdoe'
    And should redirect to '/'
&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;And this is the corresponding stories/login_story.rb which just runs the file we just created using the steps we are about to define:
&lt;div class=&quot;CodeRay&quot;&gt;
  &lt;div class=&quot;code&quot;&gt;&lt;pre&gt;require &lt;span class=&quot;co&quot;&gt;File&lt;/span&gt;.dirname(&lt;span class=&quot;pc&quot;&gt;__FILE__&lt;/span&gt;) + &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/helper&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;

with_steps_for(&lt;span class=&quot;sy&quot;&gt;:login&lt;/span&gt;) &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;
  run_local_story &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;login_story&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:type&lt;/span&gt; =&amp;gt; &lt;span class=&quot;co&quot;&gt;RailsStory&lt;/span&gt;
&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;Save the steps for this story to stories/steps/login_steps.rb:
&lt;div class=&quot;CodeRay&quot;&gt;
  &lt;div class=&quot;code&quot;&gt;&lt;pre&gt;steps_for(&lt;span class=&quot;sy&quot;&gt;:login&lt;/span&gt;) &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;co&quot;&gt;Given&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;a username '$username'&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; |username|
    &lt;span class=&quot;iv&quot;&gt;@username&lt;/span&gt; = username
  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;co&quot;&gt;Given&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;a password '$password'&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; |password|
    &lt;span class=&quot;iv&quot;&gt;@password&lt;/span&gt; = password
  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;co&quot;&gt;Given&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;an email '$email'&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; |email|
    &lt;span class=&quot;iv&quot;&gt;@email&lt;/span&gt; = email
  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;co&quot;&gt;Given&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;there is no user with this username&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;co&quot;&gt;User&lt;/span&gt;.find_by_login(&lt;span class=&quot;iv&quot;&gt;@username&lt;/span&gt;).should be_nil
  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;co&quot;&gt;When&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;the user logs in with username and password&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;
    post &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/sessions/create&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:user&lt;/span&gt; =&amp;gt; { &lt;span class=&quot;sy&quot;&gt;:login&lt;/span&gt; =&amp;gt; &lt;span class=&quot;iv&quot;&gt;@username&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:password&lt;/span&gt; =&amp;gt; &lt;span class=&quot;iv&quot;&gt;@password&lt;/span&gt; }
  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;co&quot;&gt;When&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;the user creates an account with username, password and email&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;
    post &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/users/create&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:user&lt;/span&gt; =&amp;gt; { &lt;span class=&quot;sy&quot;&gt;:login&lt;/span&gt; =&amp;gt; &lt;span class=&quot;iv&quot;&gt;@username&lt;/span&gt;,
                                     &lt;span class=&quot;sy&quot;&gt;:password&lt;/span&gt; =&amp;gt; &lt;span class=&quot;iv&quot;&gt;@password&lt;/span&gt;,
                                     &lt;span class=&quot;sy&quot;&gt;:password_confirmation&lt;/span&gt; =&amp;gt; &lt;span class=&quot;iv&quot;&gt;@password&lt;/span&gt;,
                                     &lt;span class=&quot;sy&quot;&gt;:email&lt;/span&gt; =&amp;gt; &lt;span class=&quot;iv&quot;&gt;@email&lt;/span&gt; }
  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;co&quot;&gt;Then&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;the login form should be shown again&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;
    response.should render_template(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;sessions/new&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)
  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;co&quot;&gt;Then&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;there should be a user named '$username'&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; |username|
    &lt;span class=&quot;co&quot;&gt;User&lt;/span&gt;.find_by_login(username).should_not be_nil
  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;co&quot;&gt;Then&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;should redirect to '$path'&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; |path|
    response.should redirect_to(path)
  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;When you put a $something in the sentence of a step, RSpec will
extract a value from a matching sentence in your story and pass that
into the block. Note that what you put after your $ is just fluff. It
is good practice to put quotes around your values so that there are
less cases where the regexp matcher will get confused and split things
up in a way you did not expect. Some character based regexp
expressions are allowed as well. So Then &quot;it has $n users?&quot; will match
&quot;then it has 2 users&quot; as well as &quot;then it has 1 user&quot;.&lt;/p&gt;

&lt;p&gt;We're all set! Run:&lt;/p&gt;
&lt;pre&gt;$ ruby stories/login_story.rb&lt;/pre&gt; et voil&amp;agrave;:&lt;pre&gt;2 scenarios: 2 succeeded, 0 failed, 0 pending&lt;/pre&gt;
&lt;/p&gt;

&lt;p&gt;Success!&lt;/p&gt;

&lt;p&gt;Here is a &lt;a href=&quot;http://www.tomtenthij.co.uk/assets/2008/1/28/rspec-plain-text-story-runner-on-a-fresh-rails-app.tgz&quot;&gt;tarball with the git repos&lt;/a&gt; of the steps taken in this article.&lt;/p&gt;

&lt;p&gt;Additional info on RSpec's plain text story runner:
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://dannorth.net/whats-in-a-story&quot;&gt;http://dannorth.net/whats-in-a-story&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://blog.davidchelimsky.net/articles/2007/10/21/story-runner-in-plain-english&quot;&gt;http://blog.davidchelimsky.net/articles/2007/10/21/story-runner-in-plain-english&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://blog.davidchelimsky.net/articles/2007/10/22/plain-text-stories-on-rails&quot;&gt;http://blog.davidchelimsky.net/articles/2007/10/22/plain-text-stories-on-rails&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://blog.davidchelimsky.net/articles/2007/12/14/rspec-1-1&quot;&gt;http://blog.davidchelimsky.net/articles/2007/12/14/rspec-1-1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://evang.eli.st/blog/2007/9/1/user-stories-with-rspec-s-story-runner&quot;&gt;http://evang.eli.st/blog/2007/9/1/user-stories-with-rspec-s-story-runner&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://peepcode.com/products/rspec-user-stories&quot;&gt;https://peepcode.com/products/rspec-user-stories&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://blog.aslakhellesoy.com/2007/10/24/in-browser-editor-for-rspec-stories&quot;&gt;http://blog.aslakhellesoy.com/2007/10/24/in-browser-editor-for-rspec-stories&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;
&lt;p&gt;*: the cake is a lie!&lt;/p&gt;
&lt;p&gt;Update 2008-05-27: I have changed the plugin install commands to use the git repositories instead. The original install commands were:
&lt;pre&gt;$ ./script/plugin install svn://rubyforge.org/var/svn/rspec/trunk/rspec
$ ./script/plugin install svn://rubyforge.org/var/svn/rspec/trunk/rspec_on_rails
$ ./script/plugin install http://svn.techno-weenie.net/projects/plugins/restful_authentication/&lt;/pre&gt;
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://tomtenthij.co.uk/">
    <author>
      <name>tomtt</name>
    </author>
    <id>tag:tomtenthij.co.uk,2007-12-21:9</id>
    <published>2007-12-21T11:52:00Z</published>
    <updated>2007-12-21T11:55:15Z</updated>
    <link href="http://tomtenthij.co.uk/2007/12/21/disabling-default-package-checking-for-unknown-ubuntu-commands" rel="alternate" type="text/html"/>
    <title>Disabling default package checking for unknown Ubuntu commands</title>
<content type="html">
            &lt;p&gt;Ubuntu comes with a nifty script installed that is run when you type a non-existing command. It checks to see if there is a package that will provide this command and if there is it will show you a nice message how to install it. I do like this functionality but now that my system has pretty much all I need, the slight delay caused by running the script has become annoying. I could just do a 'sudo apt-get remove command-not-found' but I would still like to able to quickly check if there is a package providing a command if I want to. A few lines added to my ~/.bashrc can do exactly that:
&lt;code&gt;&lt;pre&gt;
command_not_found_handle() {
  return 127
}
alias check-command=/usr/lib/command-not-found
&lt;/pre&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This redefines the command_not_found_handle defined in /etc/bash.bashrc to just display an error message and gives me check-command to check if a package is available for a command. And finally again 'l s-l' will barf at me instantly again :). And:
&lt;code&gt;&lt;pre&gt;
$ check-command aatv
The program 'aatv' is currently not installed.  You can install it by typing:
sudo apt-get install aatv

$ check-command emacs
Command 'emacs' is available in '/usr/bin/emacs'
&lt;/pre&gt;&lt;/code&gt;
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://tomtenthij.co.uk/">
    <author>
      <name>tomtt</name>
    </author>
    <id>tag:tomtenthij.co.uk,2007-12-13:6</id>
    <published>2007-12-13T04:58:00Z</published>
    <updated>2007-12-13T05:03:45Z</updated>
    <link href="http://tomtenthij.co.uk/2007/12/13/true-porn-clerk-stories" rel="alternate" type="text/html"/>
    <title>True Porn Clerk Stories</title>
<content type="html">
            This one has been on the inter tubes for a while but comes highly recommended by me. Ali Davis kept a journal of stories about her experiences &lt;a href=&quot;http://www.improvresourcecenter.com/mb/tpcs.html&quot;&gt;working at a video store&lt;/a&gt;.
          </content>  </entry>
  <entry xml:base="http://tomtenthij.co.uk/">
    <author>
      <name>tomtt</name>
    </author>
    <id>tag:tomtenthij.co.uk,2007-12-11:5</id>
    <published>2007-12-11T21:15:00Z</published>
    <updated>2007-12-11T21:19:46Z</updated>
    <link href="http://tomtenthij.co.uk/2007/12/11/feynman-online-resources" rel="alternate" type="text/html"/>
    <title>Feynman: online resources</title>
<content type="html">
            &lt;p&gt;My foremost personal hero is &lt;a href=&quot;http://en.wikipedia.org/wiki/Richard_Feynman&quot;&gt;Richard Feynman&lt;/a&gt;: extravagant extraordinaire and reluctant Nobel prize winner. His skill at explaining his field (theoretical physics in general and quantum mechanics in particular) was so remarkable that the notes he prepared 44 years ago are still used by physics majors world wide. More impressively: after listening to his lectures even &lt;em&gt;I&lt;/em&gt; briefly feel like I understand the subject :). He &lt;a href=&quot;http://www.fotuva.org/online/frameload.htm?/online/challenger.htm&quot;&gt;had the guts&lt;/a&gt; to &lt;a href=&quot;http://www.uky.edu/~holler/msc/roles/feynrept.html&quot;&gt;stand up&lt;/a&gt; for what he believed was the right thing to do against advise by others: a quality that seems to be &lt;a href=&quot;http://www.newsandcurrents.com/news/2007/12/kucinich-putting-finishing-touches-to-articles-of.html&quot;&gt;all too rare&lt;/a&gt; these days.&lt;/p&gt;

&lt;p&gt;Here is a list of available online resources of Richard Feynman:
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://video.google.co.uk/url?docid=8777381378502286852&quot;&gt;The pleasure of finding things out&lt;/a&gt;: BBC documentary with interviews&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://vega.org.uk/video/subseries/8&quot;&gt;The Douglas Robb Memorial Lectures&lt;/a&gt;: Feynman explaining quantum physics for the lay man in four lectures preserved on video&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.multitran.ru/c/m.exe?a=DisplayParaSent&amp;amp;fname=Richard%20Feynman&quot;&gt;The excellent stories&lt;/a&gt; in &lt;a href=&quot;http://www.amazon.co.uk/Surely-Youre-Joking-Mr-Feynman-Adventures/dp/009917331X/ref=pd_bbs_sr_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1197404604&amp;amp;sr=8-1&quot;&gt;Surely you're joking Mr. Feynman&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Other interesting stories:
&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.fotuva.org/online/&quot;&gt;Feynman Online&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.longnow.org/views/essays/articles/ArtFeynman.php?dupe=with_honor&quot;&gt;Richard Feynman and The Connection Machine&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/ul&gt;
&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://xkcd.com/182/&quot;&gt;xkcd&lt;/a&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://tomtenthij.co.uk/">
    <author>
      <name>tomtt</name>
    </author>
    <id>tag:tomtenthij.co.uk,2007-12-11:4</id>
    <published>2007-12-11T15:06:00Z</published>
    <updated>2007-12-11T15:08:39Z</updated>
    <category term="emacs"/>
    <category term="zen"/>
    <link href="http://tomtenthij.co.uk/2007/12/11/an-emacs-koan" rel="alternate" type="text/html"/>
    <title>An emacs koan</title>
<content type="html">
            &lt;p&gt;A novice of the temple once approached the Master Programmer with a question. &quot;Master, does Emacs have the Buddha nature?&quot; the novice asked. The Master Programmer had been in the temple for many years and could be relied upon to know these things. He thought for several minutes before replying. &quot;I don't see why not. It's bloody well got everything else.&quot;&lt;/p&gt;

&lt;p&gt;(shamelessly lifted from &lt;a href=&quot;http://yrk.livejournal.com/205789.html&quot;&gt;ykr&lt;/a&gt;)&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://tomtenthij.co.uk/">
    <author>
      <name>tomtt</name>
    </author>
    <id>tag:tomtenthij.co.uk,2007-12-10:2</id>
    <published>2007-12-10T14:43:00Z</published>
    <updated>2007-12-10T17:37:22Z</updated>
    <category term="autotest"/>
    <category term="bdd"/>
    <category term="emacs"/>
    <category term="rails"/>
    <category term="ruby"/>
    <link href="http://tomtenthij.co.uk/2007/12/10/emacs-flymake-and-autotest-the-fix" rel="alternate" type="text/html"/>
    <title>Emacs, flymake and autotest: the fix</title>
<content type="html">
            &lt;p&gt;I sure do love my &lt;a href=&quot;http://www.zenspider.com/ZSS/Products/ZenTest/&quot;&gt;autotest&lt;/a&gt; but I have been having problems due to how it interacts with emacs.&lt;/p&gt;

&lt;p&gt;Emacs &lt;a href=&quot;http://rubyforge.org/projects/emacs-rails/&quot;&gt;rails mode&lt;/a&gt; uses flymake to do syntax checking while you type and to do this it creates a file called buffer_name_flymake.rb in the current directory. When autotest detects this file, it starts to run it but by that time emacs has closed and deleted it already which causes autotest to crash.&lt;/p&gt;

&lt;p&gt;The only solution I could find online was to &lt;a href=&quot;http://blog.zenspider.com/archives/2007/06/autotest_freaking_out_try_v_and_nuke_the_extras.html&quot;&gt;set exceptions&lt;/a&gt; of the Autotest instance so that it will match the flymake file, but autotest only prunes directories and therefore this does not work.&lt;/p&gt;

&lt;p&gt;My solution was to add one line to the find_files method in gems/ZenTest-3.6.1/lib/autotest.rb  after line 292 that makes it always ignore flymake files:
&lt;div class=&quot;CodeRay&quot;&gt;
  &lt;div class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;no&quot;&gt;289&lt;/span&gt;       ...
&lt;span class=&quot;no&quot;&gt;&lt;strong&gt;290&lt;/strong&gt;&lt;/span&gt;       &lt;span class=&quot;r&quot;&gt;next&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; test &lt;span class=&quot;i&quot;&gt;?d&lt;/span&gt;, f
&lt;span class=&quot;no&quot;&gt;291&lt;/span&gt;       &lt;span class=&quot;r&quot;&gt;next&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; f =~ &lt;span class=&quot;rx&quot;&gt;&lt;span class=&quot;dl&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;(swp|~|rej|orig)$&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;/&lt;/span&gt;&lt;/span&gt;        &lt;span class=&quot;c&quot;&gt;# temporary/patch files&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;292&lt;/span&gt;       &lt;span class=&quot;r&quot;&gt;next&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; f =~ &lt;span class=&quot;rx&quot;&gt;&lt;span class=&quot;dl&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;\/&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;\.&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;?#&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;/&lt;/span&gt;&lt;/span&gt;                     &lt;span class=&quot;c&quot;&gt;# Emacs autosave/cvs merge files&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;293&lt;/span&gt;       &lt;span class=&quot;r&quot;&gt;next&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; f =~ &lt;span class=&quot;rx&quot;&gt;&lt;span class=&quot;dl&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;_flymake&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;\.&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;\w&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;+$&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;/&lt;/span&gt;&lt;/span&gt;      &lt;span class=&quot;c&quot;&gt;# Emacs flymake files&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;294&lt;/span&gt;       ...&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.tomtenthij.com/assets/2007/12/10/autotest.rb&quot;&gt;Download the entire patched file&lt;/a&gt;&lt;/p&gt;

I have submitted &lt;a href=&quot;http://rubyforge.org/tracker/index.php?func=detail&amp;amp;aid=16212&amp;amp;group_id=419&amp;amp;atid=1680&quot;&gt;a patch&lt;/a&gt; with this fix so hopefully the ZenTest people will include it in the next release.
          </content>  </entry>
  <entry xml:base="http://tomtenthij.co.uk/">
    <author>
      <name>tomtt</name>
    </author>
    <id>tag:tomtenthij.co.uk,2007-12-04:1</id>
    <published>2007-12-04T12:44:00Z</published>
    <updated>2007-12-06T17:22:18Z</updated>
    <link href="http://tomtenthij.co.uk/2007/12/4/first-post" rel="alternate" type="text/html"/>
    <title>First post!</title>
<content type="html">
            &lt;p&gt;Putting a weblog online has been long coming - being a web professional and all that - so I thought I'd spend my day doing just that. And here it is!&lt;/p&gt;

    &lt;p&gt;Featuring: &lt;a href=&quot;http://rubyonrails.org/&quot;&gt;Ruby on Rails (on edge)&lt;/a&gt;, &lt;a href=&quot;http://mephistoblog.com/&quot;&gt;Mephisto&lt;/a&gt;, &lt;a href=&quot;http://haml.hamptoncatlin.com/&quot;&gt;Haml&lt;/a&gt;, &lt;a href=&quot;http://slicehost.com&quot;&gt;Slicehost&lt;/a&gt;, &lt;a href=&quot;http://www.ubuntu.com/&quot;&gt;Gutsy Ubuntu&lt;/a&gt;, &lt;a href=&quot;http://www.apache.org/&quot;&gt;Apache&lt;/a&gt;, &lt;a href=&quot;http://mongrel.rubyforge.org/&quot;&gt;Mongrel&lt;/a&gt; and many others.&lt;/p&gt;
          </content>  </entry>
</feed>
