<?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: DRYing out model specs</title>
	<atom:link href="http://www.kerrybuckley.org/2007/03/11/drying-out-model-specs/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kerrybuckley.org/2007/03/11/drying-out-model-specs/</link>
	<description>What's the simplest thing that could possibly go wrong?</description>
	<lastBuildDate>Mon, 30 Jan 2012 16:30:41 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Kerry Buckley &#187; &#8220;You have to declare the controller name in controller specs&#8221;</title>
		<link>http://www.kerrybuckley.org/2007/03/11/drying-out-model-specs/comment-page-1/#comment-13901</link>
		<dc:creator>Kerry Buckley &#187; &#8220;You have to declare the controller name in controller specs&#8221;</dc:creator>
		<pubDate>Tue, 18 Dec 2007 21:35:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.kerrybuckley.com/2007/03/11/drying-out-model-specs/#comment-13901</guid>
		<description>[...] seemed that the error was being triggered by the rather unpleasant code I wrote a while ago to simplify testing of model validation. Digging into the RSpec source to see what was happening, I found that that error message only gets [...]</description>
		<content:encoded><![CDATA[<p>[...] seemed that the error was being triggered by the rather unpleasant code I wrote a while ago to simplify testing of model validation. Digging into the RSpec source to see what was happening, I found that that error message only gets [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kerry</title>
		<link>http://www.kerrybuckley.org/2007/03/11/drying-out-model-specs/comment-page-1/#comment-7942</link>
		<dc:creator>Kerry</dc:creator>
		<pubDate>Wed, 19 Sep 2007 10:02:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.kerrybuckley.com/2007/03/11/drying-out-model-specs/#comment-7942</guid>
		<description>Chris, some very good points, most of which I was aware of and all of which I fully agree with.

At the time, I decided that the trade-off between the downsides and having to write potentially hundreds of lines of test code for a single line in the model was worth it. I now think there&#039;s a better way to do this, and I&#039;m going to try re-implementing the helper as a generator, so the test code actually exists as a skeleton and can be changed afterwards.

Watch this space.</description>
		<content:encoded><![CDATA[<p>Chris, some very good points, most of which I was aware of and all of which I fully agree with.</p>
<p>At the time, I decided that the trade-off between the downsides and having to write potentially hundreds of lines of test code for a single line in the model was worth it. I now think there&#8217;s a better way to do this, and I&#8217;m going to try re-implementing the helper as a generator, so the test code actually exists as a skeleton and can be changed afterwards.</p>
<p>Watch this space.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Pratt</title>
		<link>http://www.kerrybuckley.org/2007/03/11/drying-out-model-specs/comment-page-1/#comment-7923</link>
		<dc:creator>Chris Pratt</dc:creator>
		<pubDate>Tue, 18 Sep 2007 20:22:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.kerrybuckley.com/2007/03/11/drying-out-model-specs/#comment-7923</guid>
		<description>You&#039;ve actually touched upon a controversial issue. Should my specs be DRY or should they be as expressive as possible? The general rule of thumb among the testing community seems to be in favor of expressive as possible.

First off, I appreciate the amount of work you put into this and it seems to be a very powerful helper method. So congrats on that.

However, there are a few things that do worry me about this code. First, the actual &#039;spec&#039; you end up writing is hardly more expressive than the actual implementation code: not that it necessarily has to be, but it does sort of defeat the purpose of spec&#039;ing in the first place.

Second, you&#039;ve initiated a point of failure in the spec, where you spec may fail, not because the implementation of your applications code is wrong, but because there&#039;s a bug in the helper method.

Third, you now have a rather large amount of untested code, unless you proceed to write test code for the code that generates the code for your test... head spinning...

All that aside, this is a very ingenious little helper method, so good job on that front.</description>
		<content:encoded><![CDATA[<p>You&#8217;ve actually touched upon a controversial issue. Should my specs be DRY or should they be as expressive as possible? The general rule of thumb among the testing community seems to be in favor of expressive as possible.</p>
<p>First off, I appreciate the amount of work you put into this and it seems to be a very powerful helper method. So congrats on that.</p>
<p>However, there are a few things that do worry me about this code. First, the actual &#8216;spec&#8217; you end up writing is hardly more expressive than the actual implementation code: not that it necessarily has to be, but it does sort of defeat the purpose of spec&#8217;ing in the first place.</p>
<p>Second, you&#8217;ve initiated a point of failure in the spec, where you spec may fail, not because the implementation of your applications code is wrong, but because there&#8217;s a bug in the helper method.</p>
<p>Third, you now have a rather large amount of untested code, unless you proceed to write test code for the code that generates the code for your test&#8230; head spinning&#8230;</p>
<p>All that aside, this is a very ingenious little helper method, so good job on that front.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kerry</title>
		<link>http://www.kerrybuckley.org/2007/03/11/drying-out-model-specs/comment-page-1/#comment-456</link>
		<dc:creator>Kerry</dc:creator>
		<pubDate>Wed, 14 Mar 2007 19:11:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.kerrybuckley.com/2007/03/11/drying-out-model-specs/#comment-456</guid>
		<description>Oops. Now fixed.</description>
		<content:encoded><![CDATA[<p>Oops. Now fixed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Moser</title>
		<link>http://www.kerrybuckley.org/2007/03/11/drying-out-model-specs/comment-page-1/#comment-455</link>
		<dc:creator>Paul Moser</dc:creator>
		<pubDate>Wed, 14 Mar 2007 18:44:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.kerrybuckley.com/2007/03/11/drying-out-model-specs/#comment-455</guid>
		<description>You&#039;ve got an incorrectly named variable in the specify_attributes method: you pass the valid attributes in as attr_list but within the method you refer to valid_attrs. 

(The example as it stands it works as externally you&#039;ve got a method defined called valid_attr which contains the valid attributes)</description>
		<content:encoded><![CDATA[<p>You&#8217;ve got an incorrectly named variable in the specify_attributes method: you pass the valid attributes in as attr_list but within the method you refer to valid_attrs. </p>
<p>(The example as it stands it works as externally you&#8217;ve got a method defined called valid_attr which contains the valid attributes)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.667 seconds -->

