Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

Writing examples

rdavies edited this page Apr 15, 2013 · 7 revisions

Examples in Specify are most commonly written using the it function, which accepts a name and a block, as follows:

it(@"should be green", ^{
    Object *object = [[Object alloc] init];
    [[object should] beGreen];
});

If the block is omitted, Specify will ignore the example. The PENDING command allows you to mark examples as pending:

it(@"should be green", PENDING);

it is a block, so defining custom example functions is simple:

void(^test)(NSString *, INLVoidBlock) = it;
describe(@"the stack", ^{
    test(@"stack is initially empty.", ^{
        [[[stack popObject] should] beNil];
    });
});

Here, test() becomes a function to be used for creating examples.

Clone this wiki locally