<?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: Your Private Methods are None of my Business</title>
	<atom:link href="http://blog.mattwynne.net/2008/11/07/your-private-methods-are-none-of-my-business/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mattwynne.net/2008/11/07/your-private-methods-are-none-of-my-business/</link>
	<description>Matt Wynne taking it one tea at a time</description>
	<pubDate>Wed, 10 Mar 2010 04:35:38 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: DOug</title>
		<link>http://blog.mattwynne.net/2008/11/07/your-private-methods-are-none-of-my-business/comment-page-1/#comment-893</link>
		<dc:creator>DOug</dc:creator>
		<pubDate>Sun, 03 Jan 2010 20:19:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mattwynne.net/2008/11/07/your-private-methods-are-none-of-my-business/#comment-893</guid>
		<description>&lt;p&gt;You HOT&gt;.. I'd lick that furry body all night long!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>You HOT&gt;.. I&#8217;d lick that furry body all night long!</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Me</title>
		<link>http://blog.mattwynne.net/2008/11/07/your-private-methods-are-none-of-my-business/comment-page-1/#comment-784</link>
		<dc:creator>Me</dc:creator>
		<pubDate>Mon, 07 Sep 2009 18:06:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mattwynne.net/2008/11/07/your-private-methods-are-none-of-my-business/#comment-784</guid>
		<description>&lt;p&gt;I agree, the picture is disgusting. I'm about to puke my lunch!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I agree, the picture is disgusting. I&#8217;m about to puke my lunch!</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Aki</title>
		<link>http://blog.mattwynne.net/2008/11/07/your-private-methods-are-none-of-my-business/comment-page-1/#comment-678</link>
		<dc:creator>Aki</dc:creator>
		<pubDate>Mon, 27 Jul 2009 07:05:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mattwynne.net/2008/11/07/your-private-methods-are-none-of-my-business/#comment-678</guid>
		<description>&lt;p&gt;Don't listen to that jerk, the picture is beautiful! :)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Don&#8217;t listen to that jerk, the picture is beautiful! <img src='http://blog.mattwynne.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>]]></content:encoded>
	</item>
	<item>
		<title>By: Matt</title>
		<link>http://blog.mattwynne.net/2008/11/07/your-private-methods-are-none-of-my-business/comment-page-1/#comment-663</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Thu, 09 Jul 2009 13:07:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mattwynne.net/2008/11/07/your-private-methods-are-none-of-my-business/#comment-663</guid>
		<description>&lt;p&gt;@me - so is your language! Code that isn't sufficiently encapsulated can be rather distateful too, IMO - that's the point! :)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@me - so is your language! Code that isn&#8217;t sufficiently encapsulated can be rather distateful too, IMO - that&#8217;s the point! <img src='http://blog.mattwynne.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>]]></content:encoded>
	</item>
	<item>
		<title>By: Me</title>
		<link>http://blog.mattwynne.net/2008/11/07/your-private-methods-are-none-of-my-business/comment-page-1/#comment-662</link>
		<dc:creator>Me</dc:creator>
		<pubDate>Thu, 09 Jul 2009 09:33:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mattwynne.net/2008/11/07/your-private-methods-are-none-of-my-business/#comment-662</guid>
		<description>&lt;p&gt;The picture is fucking disgusting.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>The picture is fucking disgusting.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Matt</title>
		<link>http://blog.mattwynne.net/2008/11/07/your-private-methods-are-none-of-my-business/comment-page-1/#comment-282</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Fri, 07 Nov 2008 10:46:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mattwynne.net/2008/11/07/your-private-methods-are-none-of-my-business/#comment-282</guid>
		<description>&lt;p&gt;On the subject of testing private methods, I'm with Michael Feathers and &lt;a href="http://evang.eli.st/blog/2008/10/27/testing-protected-and-private-methods-in-ruby" rel="nofollow"&gt;Pat Maddox&lt;/a&gt;: If you feel the need to do it, you probably have a concern you need to separate into another class.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>On the subject of testing private methods, I&#8217;m with Michael Feathers and <a href="http://evang.eli.st/blog/2008/10/27/testing-protected-and-private-methods-in-ruby" rel="nofollow">Pat Maddox</a>: If you feel the need to do it, you probably have a concern you need to separate into another class.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel Lucraft</title>
		<link>http://blog.mattwynne.net/2008/11/07/your-private-methods-are-none-of-my-business/comment-page-1/#comment-281</link>
		<dc:creator>Daniel Lucraft</dc:creator>
		<pubDate>Fri, 07 Nov 2008 10:11:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mattwynne.net/2008/11/07/your-private-methods-are-none-of-my-business/#comment-281</guid>
		<description>&lt;p&gt;I agree in general, but in every particular case I end up too lazy to write specs that do things like model.send(:method&lt;em&gt;name) instead of model.method&lt;/em&gt;name.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I agree in general, but in every particular case I end up too lazy to write specs that do things like model.send(:method<em>name) instead of model.method</em>name.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: JM</title>
		<link>http://blog.mattwynne.net/2008/11/07/your-private-methods-are-none-of-my-business/comment-page-1/#comment-280</link>
		<dc:creator>JM</dc:creator>
		<pubDate>Fri, 07 Nov 2008 10:02:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mattwynne.net/2008/11/07/your-private-methods-are-none-of-my-business/#comment-280</guid>
		<description>&lt;p&gt;Good point Matt! Most people even hardcore TDD programmers like myself tend to forget about protected and private methods ... The best way to remember them I guess is to feel the pain, like renaming a method and getting insulted by people impacted by your change ;-)&lt;/p&gt;

&lt;p&gt;Question, how do you test private &amp; protected methods?&lt;/p&gt;

&lt;p&gt;To be as DRY as possible, I wrote this (source code extracted from http://github.com/garnierjm/dry-report/tree/master/spec/spec&lt;em&gt;helper.rb)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;
def change&lt;em&gt;scope&lt;/em&gt;of&lt;em&gt;method&lt;/em&gt;to&lt;em&gt;public(clazz, method)
  eval("class #{clazz}
          public(:#{method.to&lt;/em&gt;s})
        end")
end
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;then before calling a private / protected method:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;
change&lt;em&gt;scope&lt;/em&gt;of&lt;em&gt;method&lt;/em&gt;to&lt;em&gt;public(DontRepeatYourself::SimianRunner, :parameter&lt;/em&gt;excludes)
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I did that because the way I TDD is with very small methods (3-4 lines max) and very long and expressive names (viva La Autocompletion!). Sometimes I stub these small methods to go straight to the behavior I want to implement. Most of the times, it's a 5-10 minutes job to write the specs for these tiny methods and make them pass ...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Good point Matt! Most people even hardcore TDD programmers like myself tend to forget about protected and private methods &#8230; The best way to remember them I guess is to feel the pain, like renaming a method and getting insulted by people impacted by your change <img src='http://blog.mattwynne.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>

<p>Question, how do you test private &amp; protected methods?</p>

<p>To be as DRY as possible, I wrote this (source code extracted from <a href="http://github.com/garnierjm/dry-report/tree/master/spec/spec" rel="nofollow">http://github.com/garnierjm/dry-report/tree/master/spec/spec</a><em>helper.rb)</em></p>

<p><code>
def change<em>scope</em>of<em>method</em>to<em>public(clazz, method)
  eval(&#8221;class #{clazz}
          public(:#{method.to</em>s})
        end&#8221;)
end
</code></p>

<p>then before calling a private / protected method:</p>

<p><code>
change<em>scope</em>of<em>method</em>to<em>public(DontRepeatYourself::SimianRunner, :parameter</em>excludes)
</code></p>

<p>I did that because the way I TDD is with very small methods (3-4 lines max) and very long and expressive names (viva La Autocompletion!). Sometimes I stub these small methods to go straight to the behavior I want to implement. Most of the times, it&#8217;s a 5-10 minutes job to write the specs for these tiny methods and make them pass &#8230;</p>]]></content:encoded>
	</item>
</channel>
</rss>
