Last active
February 21, 2016 14:22
-
-
Save mAu888/681d013a1c120ca7894f 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
class ProfileViewModelTests: XCTestCase { | |
func testDelegateNotifiedWhenProfileDeleted_Refactored() { | |
// given | |
let (viewModel, _, delegate) = initializedViewModel() | |
// when | |
viewModel.deleteProfile() | |
// then | |
XCTAssert(delegate.didDeleteUser) | |
} | |
// MARK: - Helpers | |
private func initializedViewModel() -> (ProfileViewModel, FakeAPIClient, FakeDelegate) { | |
let fakeClient = FakeAPIClient() | |
let delegate = FakeDelegate() | |
let viewModel = ProfileViewModel(apiClient: fakeClient, delegate: delegate) | |
return (viewModel, fakeClient, delegate) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment