<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: mocked_fixtures: reuse fixtures as mocks without the database</title>
	<atom:link href="http://duckpunching.com/mocked_fixtures-reuse-fixtures-as-mocks-without-the-database/feed" rel="self" type="application/rss+xml" />
	<link>http://duckpunching.com/mocked_fixtures-reuse-fixtures-as-mocks-without-the-database</link>
	<description>Ruby, Rails and tech. No ducks were harmed in the making of this blog.</description>
	<lastBuildDate>Thu, 24 Dec 2009 20:37:45 +1100</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Adam</title>
		<link>http://duckpunching.com/mocked_fixtures-reuse-fixtures-as-mocks-without-the-database/comment-page-1#comment-65</link>
		<dc:creator>Adam</dc:creator>
		<pubDate>Wed, 03 Sep 2008 20:58:21 +0000</pubDate>
		<guid isPermaLink="false">http://duckpunching.com/?p=52#comment-65</guid>
		<description>Some of the argument against fixtures is the visibility of them in your tests. If you are writing tests around a behaviour and need precise values to test it and they are off in a fixture file somewhere, it makes the spec/test less transparent and demonstrative.

But when you scale up something like object factories where you place the factories in another file, then the same issue of transparency applies.

That being said I realise there are many more arguments against fixtures.

One feature that might add to the appeal of the plugin is a feature I plan to add where you can pass a block to the fixture accessor and change the fixture values or stub other methods just for those mock fixtures returned. An example:

@company = mock_companies(:megacorp) do &#124;r&#124;
  r.stub!(:non_attribute_method).and_return(&#039;something&#039;)
  r.existing_attribute = &#039;overrided value&#039;
end

This enables easier/neater local customisation for your fixture. It would also apply to fixtures returned if you were returning multiple fixtures. 

Its not in the plugin yet but I plan to add it.</description>
		<content:encoded><![CDATA[<p>Some of the argument against fixtures is the visibility of them in your tests. If you are writing tests around a behaviour and need precise values to test it and they are off in a fixture file somewhere, it makes the spec/test less transparent and demonstrative.</p>
<p>But when you scale up something like object factories where you place the factories in another file, then the same issue of transparency applies.</p>
<p>That being said I realise there are many more arguments against fixtures.</p>
<p>One feature that might add to the appeal of the plugin is a feature I plan to add where you can pass a block to the fixture accessor and change the fixture values or stub other methods just for those mock fixtures returned. An example:</p>
<p>@company = mock_companies(:megacorp) do |r|<br />
  r.stub!(:non_attribute_method).and_return(&#8217;something&#8217;)<br />
  r.existing_attribute = &#8216;overrided value&#8217;<br />
end</p>
<p>This enables easier/neater local customisation for your fixture. It would also apply to fixtures returned if you were returning multiple fixtures. </p>
<p>Its not in the plugin yet but I plan to add it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jerry Cheung</title>
		<link>http://duckpunching.com/mocked_fixtures-reuse-fixtures-as-mocks-without-the-database/comment-page-1#comment-64</link>
		<dc:creator>Jerry Cheung</dc:creator>
		<pubDate>Wed, 03 Sep 2008 17:21:23 +0000</pubDate>
		<guid isPermaLink="false">http://duckpunching.com/?p=52#comment-64</guid>
		<description>At work we&#039;ve been using our own factory class for testing.  It&#039;s simply a class with a class method for every complex object in our app.  You use it like Factory.create_order(:currency =&gt; Factory.create_currency).  FactoryGirl&#039;s syntax looks clean, but I imagine your plugin could still be useful for applications with a lot of existing fixtures.</description>
		<content:encoded><![CDATA[<p>At work we&#8217;ve been using our own factory class for testing.  It&#8217;s simply a class with a class method for every complex object in our app.  You use it like Factory.create_order(:currency =&gt; Factory.create_currency).  FactoryGirl&#8217;s syntax looks clean, but I imagine your plugin could still be useful for applications with a lot of existing fixtures.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
