Re: NSObject -poseAs:
Re: NSObject -poseAs:
- Subject: Re: NSObject -poseAs:
- From: "Mike R. Manzano" <email@hidden>
- Date: Fri, 1 Jun 2007 10:20:35 -0700
On May 31, 2007, at 5:43 PM, Jeff Laing wrote:
It seems to me that this is not a well-formed test case. If you
"unpose",
are you expecting that a *new* singleton is going to be created, or
that the
characteristics of the singleton will stop being your mock object
and go
back to the original?
The latter.
In any case, I suspect (though I'm not sure) that you could add a
category
in your test case that overwrites the defaultSomething message in
the real
singleton class, to return your subclass.
ie,
@interface SingletonClass(TestingOnly)
+ (id)defaultSomething; // overwrite base message handler
@end
Now make defaultSomething return an instance of your
MockSingletonClass
which has appropriate gates built in, that can enable/disable
itself based
on a boolean you can twiddle via some private method.
Well, duh :) Yes I think that would work perfectly. Thanks!
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden