Da Pondelok 13 Februr 2006 06:16 Dave Cantrell napsal: > I just stumbled across the Self-Shunt unit testing pattern[0] and > decided, in my nuby quest to learn more about Ruby, to implement it in > Ruby. It's simple enough thanks to duck-typing. Almost ridiculously so, > in fact. > > My question, though, is: does the way I implemented this go against an > established ruby idiom or violate "the ruby way" in any way? If so I'd > love to hear it. > > Thanks! > -dave > > [0] http://www.objectmentor.com/resources/articles/SelfShunPtrn.pdf > I -so- needed this PDF - self-shunt is the one thing that really confused me while skimming through Beck's TDD:BE. Now if I can figure out how to do this in Java without getting a compiler induced headache, my job will be so much more fun... > main > Weakling ;P You forgot an if $0 == __FILE__, or however that idiom I never use anyway goes. Next thing we know, you're hacking the interpreter to give you warnings about mismatched signedness of variables... Anyways, thanks a lot for the code snippet, I have something to grok as relaxation at last. David Vallner