Created
July 19, 2016 04:08
-
-
Save mwrites/48c484f8748433b4f536c6d8e3147bd8 to your computer and use it in GitHub Desktop.
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
func asyncTestWithAssertBlock(block: (XCTestExpectation)->()) { | |
let expectation = self.expectationWithDescription("test expectation") | |
block(expectation) | |
waitForExpectationsWithTimeout(3, handler: nil) | |
} | |
func notifTestWithAssertBlock(block: ()-> Void) { | |
expectationForNotification(Blurbs.BlurbsReadyNotification, object: nil) { _ in | |
block() | |
return true | |
} | |
waitForExpectationsWithTimeout(3, handler: nil) | |
} | |
usage | |
func testPrepareSetPrepareFlagToTrue() { | |
subject.prepareAndNotify() | |
notifTestWithAssertBlock { | |
XCTAssertTrue(Blurbs.didCalledPrepare) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment