A barebones mocking framework. Pass the class or protocol you want to mock and the implementations of the methods you want to stub.
NSObject *mock = [REDMock mockClass:[NSObject class]
selectors:@{
REDMockMethod(isEqual:): ^BOOL(id _self, id obj) { return YES; }
}];
id<NSObject> *mock = [REDMock mockProtocol:@protocol(NSObject)
selectors:@{
REDMockMethod(isEqual:): ^BOOL(id _self, id obj) { return YES; }
}];
@interface MyClass : NSObject
- (instancetype)initWithProperty:(id)property;
@end
MyClass *mock = [REDMock mockClass:[MyClass class]
initBlock:^id(Class cls) {
return [[cls alloc] initWithProperty:@"mock"];
} selectors:@{
REDMockMethod(isEqual:): ^BOOL(id _self, id obj) { return YES; }
}];
NSObject *mock = [NSObject mock:@{
REDMockMethod(isEqual:): ^BOOL(id _self, id obj) { return YES; }
}];
==
Built using a subset of MABlockForwarding by Mike Ash