1

On iOS, I'm using Expecta to test that a certain object's property is of the correct class. Here's my Expecta expectation:

expect(splashController.reachabilityHUD).to.beKindOf([MBProgressHUD class]);

The code under test is:

self.reachabilityHUD = [[MBProgressHUD alloc] initWithView:self.view];

The error returned by the test is:

expected: a kind of MBProgressHUD, got an instance of MBProgressHUD, which is not a kind of MBProgressHUD

As expected, if I drop into lldb, I get the following:

(lldb) po [splashController.reachabilityHUD class]
MBProgressHUD
(lldb) po [MBProgressHUD class]
MBProgressHUD

I then throw this into the test:

Class actualClass = [splashController.reachabilityHUD class];
Class expectedClass = [MBProgressHUD class];

I print the same output in lldb. However, the variables view now shows:

expectedClass = (Class) 0x9e58f98
actualClass = (Class) MBProgressHUD

Why is this occurring?

GarlicFries
  • 8,095
  • 5
  • 36
  • 53
  • This is the same problem as [isMemberOfClass returns no when ViewController is instantiated from UIStoryboard](http://stackoverflow.com/questions/11675256/ismemberofclass-returns-no-when-viewcontroller-is-instantiated-from-uistoryboard) – jscs Jan 12 '14 at 03:29
  • Indeed it is--thanks for the pointer, @JoshCaswell! – GarlicFries Jan 12 '14 at 03:58

0 Answers0