Skip to content

Instantly share code, notes, and snippets.

@miwillhite
Last active December 31, 2015 11:49
Show Gist options
  • Save miwillhite/7982459 to your computer and use it in GitHub Desktop.
Save miwillhite/7982459 to your computer and use it in GitHub Desktop.
ClearMocks(mockPackage, mockAsset)
#define ClearMocks(firstMock, ...) [SpecHelper clearMocks:firstMock, nil]
@interface SpecHelper : NSObject
+ (void)clearMocks:(id)firstMock, ...;
@end
#import "SpecHelper.h"
@implementation SpecHelper
+ (void)clearMocks:(id)firstMock, ... {
id mock;
va_list args;
if (firstMock) {
firstMock = nil; /* Handled separately */
va_start(args, firstMock);
while((mock = va_arg(args, id)))
mock = nil;
va_end(args);
}
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment