Skip to content

Instantly share code, notes, and snippets.

Created August 13, 2014 09:34
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Kiwi Spec Template
#import "Kiwi.h"
static NSTimeInterval const kAsynchronousTestingTimeout = 2.0;
describe(@"An object", ^{
context(@"when...", ^{
__block Klass *object = nil;
beforeAll(^{ // or 'beforeEach', depending on your needs
object = [Klass new];
it(@"should not be nil", ^{
[[object shouldNot] beNil];
// ...
context(@"when doing some other stuff...", ^{
it(@"should...", ^{
id delegateMock = [KWMock mockForProtocol:@protocol(KlassDelegate)];
[[delegateMock stub] didUpdateKlass:any()];
object.delegate = delegateMock;
[[[delegateMock shouldEventuallyBeforeTimingOutAfter(kAsynchronousTestingTimeout)] receive] didUpdateKlass:object];
[object update];
it(@"should...", ^{
[object update];
[[expectFutureValue(object.stuff) shouldNotEventuallyBeforeTimingOutAfter(kAsynchronousTestingTimeout)] beNil];
[[expectFutureValue(theValue([object.stuff count])) shouldNotEventuallyBeforeTimingOutAfter(kAsynchronousTestingTimeout)] beZero];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment