Re: [Cedar] How to use be_instance_of

45 views
Skip to first unread message

Adam Milligan

unread,
Sep 28, 2012, 9:34:25 AM9/28/12
to cedar-...@googlegroups.com
You're not doing anything wrong.  The issue is that creating an NSString doesn't actually ever return an NSString; it's a class cluster, and the actual instantiated class is decided by some super secret Apple algorithm.  

If you try this

[[NSString string] isMemberOfClass:[NSString class]];

you'll notice that it returns false.  Odd, no?  In any case, you can get around this by allowing for subclasses, like so:

[topic title] should be_instance_of([NSString class]).or_any_subclass();

On Wed, Sep 26, 2012 at 11:59 PM, Mikhail Dikov <mdi...@gmail.com> wrote:

I have the following expectation:

[topic title] should be_instance_of([NSString class]);

However the test fails with an error that <value and (__NSCFString)> is expected to be an instance of <NSString>

What am I doing wrong?


Reply all
Reply to author
Forward
0 new messages