<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-3836263610079655093.post3159629254213296420..comments</id><updated>2010-09-01T07:02:25.941-03:00</updated><title type='text'>Comments on Daniel Cadenas: Stubbing/Mocking constants with Mocha</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.danielcadenas.com/feeds/3159629254213296420/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3836263610079655093/3159629254213296420/comments/default'/><link rel='alternate' type='text/html' href='http://www.danielcadenas.com/2008/09/stubbingmocking-constants-with-mocha.html'/><author><name>Daniel Cadenas</name><uri>http://www.blogger.com/profile/07935636187234627682</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3836263610079655093.post-8905494030340111255</id><published>2009-11-30T09:28:09.445-02:00</published><updated>2009-11-30T09:28:09.445-02:00</updated><title type='text'>Thanks, this relieved me from a lot of frustration...</title><content type='html'>Thanks, this relieved me from a lot of frustration :)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3836263610079655093/3159629254213296420/comments/default/8905494030340111255'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3836263610079655093/3159629254213296420/comments/default/8905494030340111255'/><link rel='alternate' type='text/html' href='http://www.danielcadenas.com/2008/09/stubbingmocking-constants-with-mocha.html?showComment=1259580489445#c8905494030340111255' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.danielcadenas.com/2008/09/stubbingmocking-constants-with-mocha.html' ref='tag:blogger.com,1999:blog-3836263610079655093.post-3159629254213296420' source='http://www.blogger.com/feeds/3836263610079655093/posts/default/3159629254213296420' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3836263610079655093.post-4607837885536954055</id><published>2009-09-09T16:22:14.228-03:00</published><updated>2009-09-09T16:22:14.228-03:00</updated><title type='text'>Thanks! That helped.</title><content type='html'>Thanks! That helped.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3836263610079655093/3159629254213296420/comments/default/4607837885536954055'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3836263610079655093/3159629254213296420/comments/default/4607837885536954055'/><link rel='alternate' type='text/html' href='http://www.danielcadenas.com/2008/09/stubbingmocking-constants-with-mocha.html?showComment=1252524134228#c4607837885536954055' title=''/><author><name>Sharad Jain</name><uri>http://www.blogger.com/profile/08517580119813392775</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.danielcadenas.com/2008/09/stubbingmocking-constants-with-mocha.html' ref='tag:blogger.com,1999:blog-3836263610079655093.post-3159629254213296420' source='http://www.blogger.com/feeds/3836263610079655093/posts/default/3159629254213296420' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3836263610079655093.post-8080615864722497715</id><published>2009-05-06T13:12:00.000-03:00</published><updated>2009-05-06T13:12:00.000-03:00</updated><title type='text'>Hi Daniel,

I was struggling with testing a librar...</title><content type='html'>Hi Daniel,&lt;br /&gt;&lt;br /&gt;I was struggling with testing a library module in a Rails project, and this post was very helpful in solving my problem! Many thanks!&lt;br /&gt;&lt;br /&gt;Dave</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3836263610079655093/3159629254213296420/comments/default/8080615864722497715'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3836263610079655093/3159629254213296420/comments/default/8080615864722497715'/><link rel='alternate' type='text/html' href='http://www.danielcadenas.com/2008/09/stubbingmocking-constants-with-mocha.html?showComment=1241626320000#c8080615864722497715' title=''/><author><name>Dave Hollingworth</name><uri>http://dhi.me.uk/</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.danielcadenas.com/2008/09/stubbingmocking-constants-with-mocha.html' ref='tag:blogger.com,1999:blog-3836263610079655093.post-3159629254213296420' source='http://www.blogger.com/feeds/3836263610079655093/posts/default/3159629254213296420' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3836263610079655093.post-1086708182407483047</id><published>2008-09-12T18:51:00.000-03:00</published><updated>2008-09-12T18:51:00.000-03:00</updated><title type='text'>Daniel, good example.In this commit you can see Ri...</title><content type='html'>Daniel, good example.&lt;BR/&gt;&lt;BR/&gt;In &lt;A HREF="http://github.com/technoweenie/restful-authentication/commit/20881213f76c8c8e817e18a7b276555922bb69f5" REL="nofollow"&gt;this commit&lt;/A&gt; you can see Rick "technoweenie" Olson (from rails core fame) updating his very own restful_authentication plugin with a similar approach. Although he directly stops using constants in favor of class variables with accessors.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3836263610079655093/3159629254213296420/comments/default/1086708182407483047'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3836263610079655093/3159629254213296420/comments/default/1086708182407483047'/><link rel='alternate' type='text/html' href='http://www.danielcadenas.com/2008/09/stubbingmocking-constants-with-mocha.html?showComment=1221256260000#c1086708182407483047' title=''/><author><name>oboxodo</name><uri>http://diego.algorta.net/</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.danielcadenas.com/2008/09/stubbingmocking-constants-with-mocha.html' ref='tag:blogger.com,1999:blog-3836263610079655093.post-3159629254213296420' source='http://www.blogger.com/feeds/3836263610079655093/posts/default/3159629254213296420' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3836263610079655093.post-6132821410925676376</id><published>2008-09-11T22:51:00.000-03:00</published><updated>2008-09-11T22:51:00.000-03:00</updated><title type='text'>The way Rails is moving to methods to access const...</title><content type='html'>The way Rails is moving to methods to access constants is truly a good interface. &lt;BR/&gt;&lt;BR/&gt;Also if you were in rails land, then you can use silence_warnings {} block and perhaps use a method like that that takes a block and resets the constant at the end of the block.&lt;BR/&gt;&lt;BR/&gt;def redefine_const(name,value)&lt;BR/&gt;  old_value = Object.const_get(name)&lt;BR/&gt;  silence_warnings { Object.const_set(name,value) }&lt;BR/&gt;  yield&lt;BR/&gt;ensure&lt;BR/&gt;  Object.const_set(old_value,value)&lt;BR/&gt;end</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3836263610079655093/3159629254213296420/comments/default/6132821410925676376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3836263610079655093/3159629254213296420/comments/default/6132821410925676376'/><link rel='alternate' type='text/html' href='http://www.danielcadenas.com/2008/09/stubbingmocking-constants-with-mocha.html?showComment=1221184260000#c6132821410925676376' title=''/><author><name>Ken Collins</name><uri>http://www.metaskills.net/</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.danielcadenas.com/2008/09/stubbingmocking-constants-with-mocha.html' ref='tag:blogger.com,1999:blog-3836263610079655093.post-3159629254213296420' source='http://www.blogger.com/feeds/3836263610079655093/posts/default/3159629254213296420' type='text/html'/></entry></feed>