<?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>George Brocklehurst's weblog &#187; ruby</title>
	<atom:link href="http://blog.georgebrock.com/tag/ruby/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.georgebrock.com</link>
	<description>Because some things are too long for Twitter</description>
	<lastBuildDate>Fri, 19 Feb 2010 00:15:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Testing microformats in Rails applications with assert-microformats</title>
		<link>http://blog.georgebrock.com/projects/testing-microformats-in-rails-applications-with-assert-microformats</link>
		<comments>http://blog.georgebrock.com/projects/testing-microformats-in-rails-applications-with-assert-microformats#comments</comments>
		<pubDate>Mon, 01 Jun 2009 02:00:55 +0000</pubDate>
		<dc:creator>George Brocklehurst</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[microformats]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[test-driven development]]></category>

		<guid isPermaLink="false">http://blog.georgebrock.com/?p=195</guid>
		<description><![CDATA[I&#8217;ve recently been doing a few things using Ruby on Rails. Being a proponent of microformats and increasingly a fan of test-driven development I wanted to write some tests to make sure that the microformats being produced by the Rails app I&#8217;m working on were all in the right places and contained the right information, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently been doing a few things using <a href="http://rubyonrails.org/">Ruby on Rails</a>. Being a proponent of <a href="http://microformats.org/">microformats</a> and increasingly a fan of <a href="http://en.wikipedia.org/wiki/Test-driven_development">test-driven development</a> I wanted to write some tests to make sure that the microformats being produced by the Rails app I&#8217;m working on were all in the right places and contained the right information,  so a couple of days ago I wrote a little <a href="http://rubyonrails.org/">Gem</a> called <strong>assert-microformats</strong>.</p>
<p>You can include it in your Rails app by adding this line to your test environment config file (<tt>config/environments/test.rb</tt>):</p>
<pre><code>config.gem "georgebrock-assert-microformats", :source => "http://gems.github.com/", :lib => false</code></pre>
<p>Now you can test your microformats using some shiny new assertions.</p>
<p>By default these assertions will look for microformats in Rails&#8217; <code>@response</code>:</p>
<pre><code>test "show view should contain an hcard" do
  get :show
  assert_mf_hcard
end</code></pre>
<p>You can also test the values of microformat attributes:</p>
<pre><code>assert_mf_hcard :fn => 'George Brocklehurst', :url => 'http://georgebrock.com/'</code></pre>
<p>And you can pass in some HTML, which comes in handy when you&#8217;re testing view helpers or not using Rails at all:</p>
<pre><code>assert_mf_hcalendar my_html, :summary => 'Birthday party'</code></pre>
<p>The microformat parsing is done using <a href="http://mofo.rubyforge.org/">Mofo</a>, so assert-microformats supports all the microformats that Mofo supports.</p>
<p>If you&#8217;re interested in how it works, or you want to make any changes, <a href="http://github.com/georgebrock/assert-microformats">the code is all on GitHub</a>.</p>
<p>I&#8217;d also like to thank <span class="vcard"><a href="http://tomlea.co.uk" class="fn url" rel="friend met">Tom Lea</a></span> for looking over the code and making some improvements.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.georgebrock.com/projects/testing-microformats-in-rails-applications-with-assert-microformats/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
