Brian Candler wrote:
> I'd agree with what David said. But I'd also point out that if you 
> really want to test those methods independently, you have the option of 
> using instance_variable_set and instance_variable_get

Mmm, wasn't aware of those. Yes, that could be handy.

> Alternatively, you can refactor...

Yeah, this was a quickly contrived example to show the testing 
questions. I tend to like lazy loading (and therefore memoization) 
approaches to things where its possible, and that would have driven me 
to end up  down a path similar to what you did if this were real code.

-- gw
-- 
Posted via http://www.ruby-forum.com/.