Skip to content

Instantly share code, notes, and snippets.

@diatrevolo
Created March 3, 2016 15:41
Show Gist options
  • Save diatrevolo/cd3ab7787670cf4dc62d to your computer and use it in GitHub Desktop.
Save diatrevolo/cd3ab7787670cf4dc62d to your computer and use it in GitHub Desktop.
func testGetItems_withNil() {
client = MyRESTClient(url: NSURL(string: "http://nil")!, manager: manager!)
let expectation = expectationWithDescription("GetJSONArray")
var itemsArray: [MyItem]?
client?.getAvailableItems { (items) -> () in
itemsArray = items
expectation.fulfill()
}
waitForExpectationsWithTimeout(5) { (error: NSError?) -> Void in
XCTAssert(itemsArray == nil, "Array should be nil when no items are found")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment