Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix https://github.com/kiwi-bdd/Kiwi/issues/689 #690

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Classes/Core/KWSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ @interface KWSpec()

@end

NSMutableDictionary *kw_examples;

@implementation KWSpec

/* Methods are only implemented by sub-classes */
Expand All @@ -31,6 +33,12 @@ - (NSString *)name {
return [self description];
}

+ (void)initialize {
kw_examples = [NSMutableDictionary new];
[self testInvocations];
}


/* Use camel case to make method friendly names from example description. */

- (NSString *)description {
Expand Down Expand Up @@ -58,6 +66,7 @@ + (NSArray *)testInvocations {
for (KWExample *example in exampleSuite) {
SEL selector = [self addInstanceMethodForExample:example];
NSInvocation *invocation = [self invocationForExample:example selector:selector];
[kw_examples setObject:example forKey:NSStringFromSelector(invocation.selector)];
[invocations addObject:invocation];
}

Expand Down Expand Up @@ -114,7 +123,9 @@ + (BOOL)respondsToSelector:(SEL)aSelector {

- (void)runExample {
self.currentExample = self.invocation.kw_example;

if (self.currentExample == nil) {
self.currentExample = [kw_examples objectForKey:NSStringFromSelector(self.invocation.selector)];
}
@try {
[self.currentExample runWithDelegate:self];
} @catch (NSException *exception) {
Expand Down