On Feb 16, 2005, at 10:08 AM, Ben Giddings wrote:
> If the class is mainly just a test construct and/or a proxy for actual 
> Filesystem calls, maybe "Test" or "Proxy" should be part of the class 
> name.  Secondly, method names that start with "get_" seem pretty 
> un-rubyish.  They feel more like Java getFoo() and setFoo() type 
> functions.  Maybe it would make sense to rename them just dir, file, 
> file_utils and dir_entries?

Yeah, good points. This may all be mooted if I decide to just replace 
Dir, File, FileUtils, etc with some strange magicks. We'll see.

> P.S. If you ever decide to mock out a human being, let me know.  This 
> morning in the shower I was wondering how I can mock out the person 
> who has to push a button on an embedded device I'm working on.  Sure, 
> I can easily mock out the register that pushing the button supposedly 
> changes, but that kinda defeats the purpose of the test.

Well, this won't directly solve your problem, but for an idea of how 
you might solve this, you could look at EasyPrompt, which does the same 
for a command-line user: http://easyprompt.rubyforge.org/ In 
particular, check out the MockCommandLineUser.

Funny thing is, code that uses EasyPrompt (and is thus more mockable) 
looks a lot like the example code people use when talking about 
continuations in web apps ... leading me to believe that 
continuation-based web apps would be tons easier to test across 
multi-step processes. Not that I've ever used continuations, just 
saying.

Francis Hwang
http://fhwang.net/