Skip to content

qiffp/REDMiniMock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

REDMiniMock

A barebones mocking framework. Pass the class or protocol you want to mock and the implementations of the methods you want to stub.

Examples

Using the REDMock static methods

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; }
                                       }];

Using the NSObject category

NSObject *mock = [NSObject mock:@{
                                  REDMockMethod(isEqual:): ^BOOL(id _self, id obj) { return YES; }
                                  }];

==

Built using a subset of MABlockForwarding by Mike Ash

About

A barebones Objective-C mocking framework. Totally prod ready!!1!1!!!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published