<?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: Trouble testing timestamps</title>
	<atom:link href="http://yonkeltron.com/2009/02/25/trouble-testing-timestamps/feed/" rel="self" type="application/rss+xml" />
	<link>http://yonkeltron.com/2009/02/25/trouble-testing-timestamps/</link>
	<description>Temporary Exile</description>
	<lastBuildDate>Wed, 26 May 2010 20:04:57 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: darkliquid</title>
		<link>http://yonkeltron.com/2009/02/25/trouble-testing-timestamps/comment-page-1/#comment-32698</link>
		<dc:creator>darkliquid</dc:creator>
		<pubDate>Wed, 25 Feb 2009 20:01:18 +0000</pubDate>
		<guid isPermaLink="false">http://yonkeltron.com/?p=497#comment-32698</guid>
		<description>Sounds like what you need to be doing is stubbing. It&#039;s kind of silly to be trying to test that a constantly changing value is equal to a fixed one.

Checkout mocha - http://mocha.rubyforge.org - it&#039;s a stubbing library that makes testing things much easier, especially in this regard.

For example, you&#039;d be able to do something like the below, assuming that Record.new sets ctime to be the value of Time.now:

def test_ctime
  test_time = Time.now
  Time.stubs(:new).returns(test_time)
  record = Record.new
  assert_equal(test_time, record.ctime)
end</description>
		<content:encoded><![CDATA[<p>Sounds like what you need to be doing is stubbing. It&#8217;s kind of silly to be trying to test that a constantly changing value is equal to a fixed one.</p>
<p>Checkout mocha &#8211; <a href="http://mocha.rubyforge.org" rel="nofollow">http://mocha.rubyforge.org</a> &#8211; it&#8217;s a stubbing library that makes testing things much easier, especially in this regard.</p>
<p>For example, you&#8217;d be able to do something like the below, assuming that Record.new sets ctime to be the value of Time.now:</p>
<p>def test_ctime<br />
  test_time = Time.now<br />
  Time.stubs(:new).returns(test_time)<br />
  record = Record.new<br />
  assert_equal(test_time, record.ctime)<br />
end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://yonkeltron.com/2009/02/25/trouble-testing-timestamps/comment-page-1/#comment-32697</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Wed, 25 Feb 2009 19:30:32 +0000</pubDate>
		<guid isPermaLink="false">http://yonkeltron.com/?p=497#comment-32697</guid>
		<description>http://jimmenard.blogspot.com/2009/02/time-keeps-on-slipping-so-freeze-it.html

Jim ftw!</description>
		<content:encoded><![CDATA[<p><a href="http://jimmenard.blogspot.com/2009/02/time-keeps-on-slipping-so-freeze-it.html" rel="nofollow">http://jimmenard.blogspot.com/2009/02/time-keeps-on-slipping-so-freeze-it.html</a></p>
<p>Jim ftw!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
