Created
August 13, 2014 09:34
-
-
Save nicktoumpelis/bff97452c1c9dcd60e5f to your computer and use it in GitHub Desktop.
Kiwi Spec Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "Kiwi.h" | |
static NSTimeInterval const kAsynchronousTestingTimeout = 2.0; | |
SPEC_BEGIN(KlassSpec) | |
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