<?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>Mindtonic &#187; factory_girl</title>
	<atom:link href="http://blog.mindtonic.net/tag/factory_girl/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mindtonic.net</link>
	<description>Thoughts on Music and Application Development</description>
	<lastBuildDate>Fri, 30 Jul 2010 18:08:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Webrat for integration testing</title>
		<link>http://blog.mindtonic.net/webrat-for-integration-testing/</link>
		<comments>http://blog.mindtonic.net/webrat-for-integration-testing/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 16:51:34 +0000</pubDate>
		<dc:creator>mindtonic</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[factory_girl]]></category>
		<category><![CDATA[shoulda]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[webrat]]></category>

		<guid isPermaLink="false">http://blog.mindtonic.net/?p=105</guid>
		<description><![CDATA[Webrat: http://github.com/brynary/webrat/tree/master http://gitrdoc.com/brynary/webrat/tree/master http://codese.wordpress.com/2009/02/05/using-shoulda-webrat-to-write-integration-tests-for-rails/ http://blog.bitmacro.com/2008/11/14/shoulda-factory_girl-webrat Integration Testing: http://weblog.jamisbuck.org/2006/3/9/integration-testing-in-rails-1-1 http://www.martinfowler.com/articles/continuousIntegration.html http://api.rubyonrails.org/classes/ActionController/Integration/Session.html http://locomotivation.squeejee.com/post/109227509/ruby-on-rails-integration-testing-with-integrity http://ajaxonrails.wordpress.com/2006/11/02/integration-testing-in-ruby-on-rails-how-to-maintain-sessions-while-testing-in-rails/ http://bhanoo.blogspot.com/2007/09/rails-integration-testing.html http://blog.danielwellman.com/2008/06/writing-rails-integration-tests-with-webrat.html http://6brand.com/rails-integration-testing-how-to-learn.html]]></description>
			<content:encoded><![CDATA[<p><strong>Webrat:</strong></p>
<ul>
<li><a href="http://github.com/brynary/webrat/tree/master">http://github.com/brynary/webrat/tree/master</a></li>
<li><a href="http://gitrdoc.com/brynary/webrat/tree/master">http://gitrdoc.com/brynary/webrat/tree/master</a></li>
<li><a href="http://codese.wordpress.com/2009/02/05/using-shoulda-webrat-to-write-integration-tests-for-rails/">http://codese.wordpress.com/2009/02/05/using-shoulda-webrat-to-write-integration-tests-for-rails/</a></li>
<li><a href="http://blog.bitmacro.com/2008/11/14/shoulda-factory_girl-webrat">http://blog.bitmacro.com/2008/11/14/shoulda-factory_girl-webrat</a></li>
</ul>
<p><strong>Integration Testing:</strong></p>
<ul>
<li><a href=" http://weblog.jamisbuck.org/2006/3/9/integration-testing-in-rails-1-1"> http://weblog.jamisbuck.org/2006/3/9/integration-testing-in-rails-1-1</a></li>
<li><a href="http://www.martinfowler.com/articles/continuousIntegration.html">http://www.martinfowler.com/articles/continuousIntegration.html</a></li>
<li><a href="http://api.rubyonrails.org/classes/ActionController/Integration/Session.html">http://api.rubyonrails.org/classes/ActionController/Integration/Session.html</a></li>
<li><a href="http://locomotivation.squeejee.com/post/109227509/ruby-on-rails-integration-testing-with-integrity">http://locomotivation.squeejee.com/post/109227509/ruby-on-rails-integration-testing-with-integrity</a></li>
<li><a href="http://ajaxonrails.wordpress.com/2006/11/02/integration-testing-in-ruby-on-rails-how-to-maintain-sessions-while-testing-in-rails/">http://ajaxonrails.wordpress.com/2006/11/02/integration-testing-in-ruby-on-rails-how-to-maintain-sessions-while-testing-in-rails/</a></li>
<li><a href="http://bhanoo.blogspot.com/2007/09/rails-integration-testing.html">http://bhanoo.blogspot.com/2007/09/rails-integration-testing.html</a></li>
<li><a href="http://blog.danielwellman.com/2008/06/writing-rails-integration-tests-with-webrat.html">http://blog.danielwellman.com/2008/06/writing-rails-integration-tests-with-webrat.html</a></li>
<li><a href="http://6brand.com/rails-integration-testing-how-to-learn.html">http://6brand.com/rails-integration-testing-how-to-learn.html</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.mindtonic.net/webrat-for-integration-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Factory Girl stringify_keys error in Create Test</title>
		<link>http://blog.mindtonic.net/factory-girl-stringify_keys-error-in-create-test/</link>
		<comments>http://blog.mindtonic.net/factory-girl-stringify_keys-error-in-create-test/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 21:52:21 +0000</pubDate>
		<dc:creator>mindtonic</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[factory_girl]]></category>
		<category><![CDATA[shoulda]]></category>

		<guid isPermaLink="false">http://blog.mindtonic.net/?p=50</guid>
		<description><![CDATA[I was getting the following error while trying to test the create method of a controller using factory_girl and shoulda: NoMethodError: undefined method `stringify_keys!` The error was that I am sending an object to the create method, which actually requires a hash of attributes&#8230; the solution is to use factory_girl&#8217;s attributes_for method. Hope this helps! [...]]]></description>
			<content:encoded><![CDATA[<p>I was getting the following error while trying to test the create method of a controller using <a href="http://github.com/thoughtbot/factory_girl/tree/master">factory_girl</a> and <a href="http://github.com/thoughtbot/shoulda/tree/master">shoulda</a>:</p>
<p><code>NoMethodError: undefined method `stringify_keys!`</code></p>
<p>The error was that I am sending an object to the create method, which actually requires a hash of attributes&#8230; the solution is to use factory_girl&#8217;s <strong>attributes_for</strong> method. </p>
<p>Hope this helps!</p>
<textarea cols="40" rows="10" name="code" class="Ruby">My testing code looked like this:

context "on POST to :create" do
  setup { post :create, :expense => Factory.build(:expense) }
    
  should_assign_to :expense
  should_redirect_to("the expense's show page") { expense_url(assigns(:expense)) } 
  should_set_the_flash_to(/created/i)
end

The correct code is:

context "on POST to :create" do
  setup { post :create, :expense => Factory.attributes_for(:expense) }
    
  should_assign_to :expense
  should_redirect_to("the expense's show page") { expense_url(assigns(:expense)) } 
  should_set_the_flash_to(/created/i)
end
</code></textarea>
	<!-- WordPress Code Snippet -->
	<script type="text/javascript" src="http://blog.mindtonic.net/wp-content/plugins/wordpress-code-snippet/js/shCore.js"></script><script type="text/javascript" src="http://blog.mindtonic.net/wp-content/plugins/wordpress-code-snippet/js/shBrushRuby.js"></script>
	<link type="text/css" rel="stylesheet" href="http://blog.mindtonic.net/wp-content/plugins/wordpress-code-snippet/css/SyntaxHighlighter.css"/>
	
	<script language="javascript">
	dp.SyntaxHighlighter.ClipboardSwf = 'http://blog.mindtonic.net/wp-content/plugins/wordpress-code-snippet/js/clipboard.swf';
	dp.SyntaxHighlighter.HighlightAll('code');
	</script>
	<!-- End WordPress Code Snippet -->
	]]></content:encoded>
			<wfw:commentRss>http://blog.mindtonic.net/factory-girl-stringify_keys-error-in-create-test/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
