<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://nolan.eakins.net" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>Nolan&#039;s Corner - Rails</title>
 <link>http://nolan.eakins.net/taxonomy/term/28/0</link>
 <description>Ruby on Rails</description>
 <language>en</language>
<item>
 <title>RSpec matcher helper</title>
 <link>http://nolan.eakins.net/node/311</link>
 <description>&lt;p&gt;
I&#039;ve finally written more than one RSpec matcher. Creating a matcher essentially involves defining a class and a method that creates an instance of that class. Rather redundant, resulting in my RSpec matcher helper:
&lt;/p&gt;
&lt;pre&gt;
def defmatcher(name, &amp;code)
  klass = Class.new
  klass.module_eval(&amp;code)
  
  Object.send :define_method, name.to_s do |*args|
    klass.new(*args)
  end
end
&lt;/pre&gt;&lt;p&gt;
That little method, &lt;code&gt;defmatcher&lt;/code&gt;, creates the class and method for you. It saves some typing. An example can be found in the full source file, &lt;a href=&quot;/system/files/spec_matcher_dsl.rb&quot;&gt;available here&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Update (2008/06/28):&lt;/b&gt; RSpec was having trouble keeping this all in one file. I created a project at GitHub to host this for the time being: &lt;a href=&quot;http://github.com/sneakin/spec_matcher_helper/&quot;&gt;http://github.com/sneakin/spec_matcher_helper/&lt;/a&gt;&lt;/p&gt;
&lt;table id=&quot;attachments&quot;&gt;
 &lt;thead&gt;&lt;tr&gt;&lt;th&gt;Attachment&lt;/th&gt;&lt;th&gt;Size&lt;/th&gt; &lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
 &lt;tr class=&quot;odd&quot;&gt;&lt;td&gt;&lt;a href=&quot;http://nolan.eakins.net/system/files/spec_matcher_dsl.rb&quot;&gt;spec_matcher_dsl.rb&lt;/a&gt;&lt;/td&gt;&lt;td&gt;1.45 KB&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
</description>
 <comments>http://nolan.eakins.net/node/311#comment</comments>
 <category domain="http://nolan.eakins.net/taxonomy/term/14">Personal</category>
 <category domain="http://nolan.eakins.net/taxonomy/term/9">Programming</category>
 <category domain="http://nolan.eakins.net/taxonomy/term/28">Rails</category>
 <enclosure url="http://nolan.eakins.net/system/files/spec_matcher_dsl.rb" length="1484" type="application/octet-stream" />
 <pubDate>Sat, 28 Jun 2008 16:25:54 -0700</pubDate>
 <dc:creator>sneakin</dc:creator>
 <guid isPermaLink="false">311 at http://nolan.eakins.net</guid>
</item>
<item>
 <title>Bitter</title>
 <link>http://nolan.eakins.net/node/307</link>
 <description>&lt;p&gt;
I slipped up a new site &lt;a href=&quot;http://bitter.nolan.eakins.net/&quot;&gt;bitter.nolan.eakins.net&lt;/a&gt; the other day. It&#039;s my take on the don&#039;t make me think blog. I&#039;ve already implemented a basic web interface and just slapped together an XMPP bot that makes &lt;a href=&quot;http://bitter.rubyforge.org/&quot;&gt;Bitter&lt;/a&gt; much easier to use. There&#039;s a lot that I&#039;ve left out, but I put a &lt;a href=&quot;http://www.bazaar-vcs.org/&quot;&gt;Bazaar&lt;/a&gt; &lt;a href=&quot;http://bitter.rubyforge.org/bzr/bitter/TRUNK&quot;&gt;repository up&lt;/a&gt; if anyone wants to play.
&lt;/p&gt;</description>
 <comments>http://nolan.eakins.net/node/307#comment</comments>
 <category domain="http://nolan.eakins.net/taxonomy/term/11">Jabber</category>
 <category domain="http://nolan.eakins.net/taxonomy/term/14">Personal</category>
 <category domain="http://nolan.eakins.net/taxonomy/term/28">Rails</category>
 <category domain="http://nolan.eakins.net/taxonomy/term/26">Web</category>
 <pubDate>Mon, 03 Dec 2007 02:48:38 -0800</pubDate>
 <dc:creator>sneakin</dc:creator>
 <guid isPermaLink="false">307 at http://nolan.eakins.net</guid>
</item>
</channel>
</rss>
