2

I am getting start with writing unit test for all my models classes in my project.

There is a class method in QUUserModel I would like to test in this case:

+ (BOOL)isRegistedPhoneNumber:(NSString *) phoneNumber{
    AVQuery *query = [AVUser query];
    [query whereKey:@"mobilePhoneNumber" equalTo:phoneNumber];
    return [query countObjects] > 0;
}

So what I achieved is just look likes:

#import <Specta.h>
#define EXP_SHORTHAND
#import <OCMock.h>
#import "QUUserModel.h"
#import <Expecta.h>

SpecBegin(QUUserModel)

describe(@"QUUserModel", ^{
    it(@"is registered with phone number", ^{
        id userModel = OCMClassMock([QUUserModel class]);
                                                 ~~~~~
    });
});

SpecEnd

This raised an error:

No known class method for selector 'class'

I noticed that the QUUserModel class is subclassing of AVUser, a class from SDK.

@interface QUUserModel : AVUser<AVSubclassing> 

Any one could guide me to what I can do ?

Zigii Wong
  • 7,766
  • 8
  • 51
  • 79

0 Answers0