<?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>Yan Pritzker &#187; testing</title>
	<atom:link href="http://yanpritzker.com/category/testing/feed/" rel="self" type="application/rss+xml" />
	<link>http://yanpritzker.com</link>
	<description>photographer, entrepreneur, software engineer, musician, skier</description>
	<lastBuildDate>Sat, 21 Jan 2012 01:18:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<atom:link rel="next" href="http://yanpritzker.com/category/testing/feed/?page=2" />

		<item>
		<title>Testing your ActiveRecord migrations</title>
		<link>http://yanpritzker.com/2008/06/09/testing-your-activerecord-migrations/</link>
		<comments>http://yanpritzker.com/2008/06/09/testing-your-activerecord-migrations/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 17:00:11 +0000</pubDate>
		<dc:creator>yan</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[RubyOnRails]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[thoughts]]></category>

		<guid isPermaLink="false">http://skwpspace.com/?p=164</guid>
		<description><![CDATA[Sometimes you have a data migration that creates or modifies records in some way, and you would like to test it in your unit tests right? Except that Rails typically just clones the structure of your dev database, not its data. So how do you test that a migration succeeded? Simple, just invoke it during [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you have a data migration that creates or modifies records in some way, and you would like to test it in your unit tests right? Except that Rails typically just clones the structure of your dev database, not its data. So how do you test that a migration succeeded? Simple, just invoke it during your test:</p>
<p>This code is written using the <a href="http://www.thoughtbot.com/projects/shoulda">shoulda</a> plugin which gives a slightly more verbose breakdown of the setup and the test, but it can be done with test/unit just as well.</p>
<pre><code>
context "orphan user migration" do
  setup do
    require "#{RAILS_ROOT}/db/migrate/163_create_orphan_owner"
    CreateOrphanOwner.up
  end
  should "create the orphan user" do
    assert orphan = User.orphan_owner
    assert orphan.role?(User::ORPHAN_OWNER)
  end
end
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://yanpritzker.com/2008/06/09/testing-your-activerecord-migrations/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

