On 11/3/2010 5:20 AM, Robert Klemme wrote:
> On Tue, Nov 2, 2010 at 9:29 PM, Jeremy Bopp <jeremy / bopp.net> wrote:
>> What I'm about to suggest will generate warnings from Ruby and is
>> probably not the "best" way, but you could also replace OtherClass with
>> your MockLoggerClass with a simple assignment during your test:
>>
>> OtherClass = MockLoggerClass  # This generates a warning...
>> s = SomeClass.new
>> s.do_something(1, 2)
> 
> This is not exactly the same as it does not allow control over the
> created instance per instance.  You basically change global state vs.
> Manuel's approach with local state.

I agree, but I was approaching this from a minimal unit test standpoint
rather than a generally applicable part of Manuel's design.  Would you
say that changing the global state in this way or in the other way I
suggested is still a problem in that case?

-Jeremy