Skip to content

Commit

Permalink
Merge pull request kiwi-bdd#198 from Antol/master
Browse files Browse the repository at this point in the history
kiwi-bdd#190 AfterAll not called
  • Loading branch information
allending committed Jan 24, 2013
2 parents 5b2f344 + 5ff90f8 commit 7405d46
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Classes/KWExample.h
Expand Up @@ -23,7 +23,7 @@
id<KWExampleNode> exampleNode;
BOOL passed;
}
@property (nonatomic, retain) KWContextNode *lastInContext;
@property (nonatomic, retain, readonly) NSMutableArray *lastInContexts;
@property (nonatomic, assign) KWExampleSuite *suite;

- (id)initWithExampleNode:(id<KWExampleNode>)node;
Expand Down
12 changes: 9 additions & 3 deletions Classes/KWExample.m
Expand Up @@ -43,7 +43,7 @@ @implementation KWExample
@synthesize verifiers;
@synthesize delegate = _delegate;
@synthesize suite;
@synthesize lastInContext;
@synthesize lastInContexts;
@synthesize didNotFinish;

- (id)initWithExampleNode:(id<KWExampleNode>)node
Expand All @@ -52,14 +52,15 @@ - (id)initWithExampleNode:(id<KWExampleNode>)node
exampleNode = [node retain];
matcherFactory = [[KWMatcherFactory alloc] init];
verifiers = [[NSMutableArray alloc] init];
lastInContexts = [[NSMutableArray alloc] init];
passed = YES;
}
return self;
}

- (void)dealloc
{
[lastInContext release];
[lastInContexts release];
[exampleNode release];
[matcherFactory release];
[verifiers release];
Expand All @@ -68,7 +69,12 @@ - (void)dealloc

- (BOOL)isLastInContext:(KWContextNode *)context
{
return context == self.lastInContext;
for (KWContextNode *contextWhereItLast in lastInContexts) {
if (context == contextWhereItLast) {
return YES;
}
}
return NO;
}

- (NSString *)description
Expand Down
7 changes: 4 additions & 3 deletions Classes/KWExampleSuite.m
Expand Up @@ -42,9 +42,10 @@ - (void)addExample:(KWExample *)example

- (void)markLastExampleAsLastInContext:(KWContextNode *)context
{
if ([examples count] > 0) {
[[examples objectAtIndex:examples.count-1] setLastInContext:context];
}
if ([examples count] > 0) {
KWExample *lastExample = (KWExample *)[examples lastObject];
[lastExample.lastInContexts addObject:context];
}
}

- (NSArray *)invocationsForTestCase;
Expand Down

0 comments on commit 7405d46

Please sign in to comment.