Skip to content

Commit

Permalink
Merge remote branch 'petejkim/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Milligan committed Apr 23, 2011
2 parents b4822c9 + 8b7cdbf commit 6e03a82
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Source/CDRSpec.m
Expand Up @@ -32,6 +32,22 @@ void fail(NSString *reason) {
[[CDRSpecFailure specFailureWithReason:[NSString stringWithFormat:@"Failure: %@", reason]] raise]; [[CDRSpecFailure specFailureWithReason:[NSString stringWithFormat:@"Failure: %@", reason]] raise];
} }


void context(NSString *text, CDRSpecBlock block) {
describe(text, block);
}

void xcontext(NSString *text, CDRSpecBlock block) {
it(text, PENDING);
}

void xdescribe(NSString *text, CDRSpecBlock block) {
it(text, PENDING);
}

void xit(NSString *text, CDRSpecBlock block) {
it(text, PENDING);
}

@implementation CDRSpec @implementation CDRSpec


@synthesize currentGroup = currentGroup_, rootGroup = rootGroup_; @synthesize currentGroup = currentGroup_, rootGroup = rootGroup_;
Expand Down
4 changes: 4 additions & 0 deletions Source/Headers/CDRSpec.h
Expand Up @@ -17,6 +17,10 @@ void beforeEach(CDRSpecBlock);
void afterEach(CDRSpecBlock); void afterEach(CDRSpecBlock);
void it(NSString *, CDRSpecBlock); void it(NSString *, CDRSpecBlock);
void fail(NSString *); void fail(NSString *);
void context(NSString *, CDRSpecBlock);
void xcontext(NSString *, CDRSpecBlock);
void xdescribe(NSString *, CDRSpecBlock);
void xit(NSString *, CDRSpecBlock);
#ifdef __cplusplus #ifdef __cplusplus
} }


Expand Down
21 changes: 21 additions & 0 deletions Spec/SpecSpec.m
Expand Up @@ -56,12 +56,33 @@ void expectFailure(CDRSpecBlock block) {
}); });
}); });


context(@"a nested spec (context)", ^ {
beforeEach(^ {
// NSLog(@"=====================> I should run only before the nested specs.");
});

afterEach(^ {
// NSLog(@"=====================> I should run only after the nested specs.");
});

it(@"should also run", ^ {
// NSLog(@"=====================> Nested spec");
});

it(@"should also also run", ^ {
// NSLog(@"=====================> Another nested spec");
});
});

it(@"should run", ^ { it(@"should run", ^ {
// NSLog(@"=====================> Spec"); // NSLog(@"=====================> Spec");
}); });


it(@"should be pending", PENDING); it(@"should be pending", PENDING);
it(@"should also be pending", nil); it(@"should also be pending", nil);
xit(@"should also be pending (xit)", ^{});
xcontext(@"xcontexted specs should be pending", ^{});
xdescribe(@"xdescribed specs should be pending", ^{});
}); });


describe(@"The spec failure exception", ^{ describe(@"The spec failure exception", ^{
Expand Down

0 comments on commit 6e03a82

Please sign in to comment.