<?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: Rails Testing Strategies: Valid and Invalid Data</title>
	<atom:link href="http://www.sciwerks.com/blog/2006/06/12/rails-testing-strategies-valid-and-invalid-data/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sciwerks.com/blog/2006/06/12/rails-testing-strategies-valid-and-invalid-data/</link>
	<description>Software for scientists, by scientists</description>
	<lastBuildDate>Thu, 19 Aug 2010 22:43:31 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Antti Tarvainen</title>
		<link>http://www.sciwerks.com/blog/2006/06/12/rails-testing-strategies-valid-and-invalid-data/comment-page-1/#comment-93</link>
		<dc:creator>Antti Tarvainen</dc:creator>
		<pubDate>Fri, 17 Nov 2006 08:03:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.sciwerks.com/blog/2006/06/12/rails-testing-strategies-valid-and-invalid-data/#comment-93</guid>
		<description>I was trying to say that to prevent such problems you should use require_dependency instead of the plain require.</description>
		<content:encoded><![CDATA[<p>I was trying to say that to prevent such problems you should use require_dependency instead of the plain require.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Antti Tarvainen</title>
		<link>http://www.sciwerks.com/blog/2006/06/12/rails-testing-strategies-valid-and-invalid-data/comment-page-1/#comment-92</link>
		<dc:creator>Antti Tarvainen</dc:creator>
		<pubDate>Thu, 16 Nov 2006 15:02:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.sciwerks.com/blog/2006/06/12/rails-testing-strategies-valid-and-invalid-data/#comment-92</guid>
		<description>Thanks for the tip, Kevin. 

I tried to use this technique also in development mode so that I can quickly create new data to play with. Just so that others don&#039;t have to spend three hours hunting for the problem: there&#039;s an issue with loading dependencies. It doesn&#039;t matter in testing because because the classes are loaded only once. However, in development mode you need to do this:

  class Item </description>
		<content:encoded><![CDATA[<p>Thanks for the tip, Kevin. </p>
<p>I tried to use this technique also in development mode so that I can quickly create new data to play with. Just so that others don&#8217;t have to spend three hours hunting for the problem: there&#8217;s an issue with loading dependencies. It doesn&#8217;t matter in testing because because the classes are loaded only once. However, in development mode you need to do this:</p>
<p>  class Item</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Nielsen</title>
		<link>http://www.sciwerks.com/blog/2006/06/12/rails-testing-strategies-valid-and-invalid-data/comment-page-1/#comment-7</link>
		<dc:creator>Eric Nielsen</dc:creator>
		<pubDate>Mon, 12 Jun 2006 18:08:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.sciwerks.com/blog/2006/06/12/rails-testing-strategies-valid-and-invalid-data/#comment-7</guid>
		<description>I&#039;ve been using the following custom assertion to help with negative testing of validates_presence_of:

&lt;code lang=&quot;ruby&quot;&gt;
def assert_presence_of(var, field)
  assert var.errors.invalid?(field)
end
&lt;/code&gt;

I&#039;ve been struggling with a lot of the issues for how to TDD the Model elements -- don&#039;t want to test the &quot;magic&quot; of AR, but want to test that the desired fields are present in the model, even before getting to the issue of testing validations....  (See my blog for my evolving struggle.)</description>
		<content:encoded><![CDATA[<p>I&#8217;ve been using the following custom assertion to help with negative testing of validates_presence_of:</p>
<div class="codesnip-container" >
<div class="codesnip" style="font-family: monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">def</span> assert_presence_of<span class="br0">&#40;</span>var, field<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; assert var.<span class="me1">errors</span>.<span class="me1">invalid</span>?<span class="br0">&#40;</span>field<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">end</span> </div>
</li>
</ol>
</div>
</div>
<p>I&#8217;ve been struggling with a lot of the issues for how to TDD the Model elements &#8212; don&#8217;t want to test the &#8220;magic&#8221; of AR, but want to test that the desired fields are present in the model, even before getting to the issue of testing validations&#8230;.  (See my blog for my evolving struggle.)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
