Created
July 12, 2014 19:59
-
-
Save rdh/1f1ed27f9fdfc58cd979 to your computer and use it in GitHub Desktop.
Kiwi expectFutureValue() and shouldEventually interaction
This file contains hidden or 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
// | |
// KoalaSpec.m | |
// koala | |
// | |
// Created by Rich Humphrey on 7/12/14. | |
// Copyright (c) 2014 Lean Labs. All rights reserved. | |
// | |
#import <XCTest/XCTest.h> | |
#import "Kiwi.h" | |
SPEC_BEGIN(KoalaSpec) | |
describe( @"shouldEventually", ^{ | |
context( @"with a block on the main queue", ^{ | |
context( @"wrapped in expectFutureValue", ^{ | |
it( @"passes with expectation after call", ^{ | |
__block NSString *string = nil; | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
string = @"test"; | |
}); | |
[[expectFutureValue(string) shouldEventually] beNonNil]; | |
}); | |
it( @"fails with expectation before", ^{ | |
__block NSString *string = nil; | |
[[expectFutureValue(string) shouldEventually] beNonNil]; | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
string = @"test"; | |
}); | |
}); | |
}); | |
context( @"not wrapped in expectFutureValue", ^{ | |
it( @"passes with expectation after", ^{ | |
__block NSString *string = nil; | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
string = @"test"; | |
}); | |
[[string shouldEventually] beNonNil]; | |
}); | |
it( @"passes with expectation before", ^{ | |
__block NSString *string = nil; | |
[[string shouldEventually] beNonNil]; | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
string = @"test"; | |
}); | |
}); | |
}); | |
}); | |
}); | |
SPEC_END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment