Skip to content

Instantly share code, notes, and snippets.

@SlaunchaMan
Created November 19, 2013 18:42
Show Gist options
  • Save SlaunchaMan/7550294 to your computer and use it in GitHub Desktop.
Save SlaunchaMan/7550294 to your computer and use it in GitHub Desktop.
Checking if an Objective-C class implements required protocol methods using Kiwi
it(@"should implement the required methods in the protocol", ^{
unsigned int methodCount;
struct objc_method_description *methodList =
protocol_copyMethodDescriptionList(NSProtocolFromString(@"ProtocolName"),
YES,
YES,
&methodCount);
for (unsigned int i = 0; i < methodCount; i++) {
SEL methodName = methodList[i].name;
[[objectBeingTested should] respondToSelector:methodName];
}
if (methodList != NULL) {
free(methodList);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment