<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div><br></div><div>> Incidentally, I was listening to an interesting podcast interview with<br>> Gary Bernhardt yesterday.  Among other things, it touched on different<br>> approaches to testing; might be a good start to further exploration.<br><a href="http://www.engineyard.com/podcast/s01e40-gary-bernhardt" target="_blank">> http://www.engineyard.com/podcast/s01e40-gary-bernhardt</a><br><span></span></div><div><br><span></span></div><div>Interesting interview this was. Has anyone used classes in the lib folder extensively as Gary suggests? How have you found it? <br></div><div> I can think of a few of my projects where this make sense and hopefully speed up autotest.</div><div><br></div><div><span>Cheers</span></div><div> </div><div><i>James Cumming, CFA<br></i>+44 7799 554468<br></div>  <div style="font-family:
 arial, helvetica, sans-serif; font-size: 10pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <font size="2" face="Arial"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> Sam Livingston-Gray <geeksam@gmail.com><br> <b><span style="font-weight: bold;">To:</span></b> London Ruby Users Group <chat@lists.lrug.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Tuesday, 22 November 2011, 18:03<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [LRUG] A question on DRYness on testing methods that get / set state<br> </font> <br>+1 to what Tom said.  Duplication was the smell; the underlying cause<br>was that you're thinking about your code from the wrong perspective.<br>(=  In this case, deleting one of the tests and renaming the other (it<br>"holds an item for later retrieval", perhaps?) would be a good first<br>step.<br><br>That being said, I'm more
 tolerant of duplication in my tests than in<br>my code under test.  I've also been discovering that having a few<br>integration tests written first (in a top-down style) can make<br>refactoring easier.  I've tended to do bottom-up TDD, which creates<br>API inertia (in that changing the public interface of classes is more<br>likely to break tests); if I've not yet reached a point where I have a<br>higher-level test that specifies something the user cares about, it's<br>very easy to either go down a rathole ("fix ALL the tests!") or give<br>up and accept a subpar API because too many things go red.<br><br>Incidentally, I was listening to an interesting podcast interview with<br>Gary Bernhardt yesterday.  Among other things, it touched on different<br>approaches to testing; might be a good start to further exploration.<br><a href="http://www.engineyard.com/podcast/s01e40-gary-bernhardt"
 target="_blank">http://www.engineyard.com/podcast/s01e40-gary-bernhardt</a><br><br>-Sam<br><br><br><br>On Tue, Nov 22, 2011 at 3:31 AM, Tim Cowlishaw <<a ymailto="mailto:tim@timcowlishaw.co.uk" href="mailto:tim@timcowlishaw.co.uk">tim@timcowlishaw.co.uk</a>> wrote:<br>> On Tue, Nov 22, 2011 at 11:29 AM, Tom Stuart <<a ymailto="mailto:tom@experthuman.com" href="mailto:tom@experthuman.com">tom@experthuman.com</a>> wrote:<br>><br>>> Spec behaviour, not implementation. I'd have a single example that covers the behaviour "when I put a value, get should return that value".<br>><br>> Aah ok, that makes far more sense - I've tended to tie my specs quite<br>> closely to the interface being exposed in the past (ie, at least one<br>> spec per public method per class), but I guess there's no real need<br>> to.<br>><br>> Thanks!<br>><br>> Tim<br>> _______________________________________________<br>> Chat
 mailing list<br>> <a ymailto="mailto:Chat@lists.lrug.org" href="mailto:Chat@lists.lrug.org">Chat@lists.lrug.org</a><br>> <a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br>><br>_______________________________________________<br>Chat mailing list<br><a ymailto="mailto:Chat@lists.lrug.org" href="mailto:Chat@lists.lrug.org">Chat@lists.lrug.org</a><br><a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br><br><br> </div> </div>  </div></body></html>