Created
December 15, 2015 13:19
-
-
Save eofster/dd1ec5092411749b82b7 to your computer and use it in GitHub Desktop.
GPS track summary view event handler tests
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
import XCTest | |
class TrackSummaryViewEventHandlerTests: XCTestCase { | |
private(set) var interactorSpy: InteractorSpy! | |
private(set) var factorySpy: InteractorFactorySpy! | |
private(set) var eventHandler: TrackSummaryViewEventHandler! | |
override func setUp() { | |
super.setUp() | |
interactorSpy = InteractorSpy() | |
factorySpy = InteractorFactorySpy() | |
eventHandler = TrackSummaryViewEventHandler( | |
interactorFactory: factorySpy, | |
presenterFactory: PresenterFactoryImpl() | |
) | |
} | |
func testExecutesTrackSummaryInteractorOnViewDataReload() { | |
factorySpy.stubWithTrackSummaryInteractor(interactorSpy) | |
eventHandler.viewShouldReloadData(TrackSummaryViewDummy()) | |
XCTAssertTrue(interactorSpy.didCallExecute) | |
} | |
func testCreatesTrackNameUpdateInteractorWithExpectedParametersOnNameUpdate() { | |
factorySpy.stubWithTrackNameUpdateInteractor(InteractorSpy()) | |
eventHandler.view(TrackSummaryViewDummy(), didChangeTrackName: "Trip", forTrackWithID: 2) | |
XCTAssertEqual(factorySpy.invokedName, "Trip") | |
XCTAssertEqual(factorySpy.invokedTrackID, 2) | |
} | |
func testExecutesTracknameUpdateInteractorOnNameUpdate() { | |
factorySpy.stubWithTrackNameUpdateInteractor(interactorSpy) | |
eventHandler.view(TrackSummaryViewDummy(), didChangeTrackName: "", forTrackWithID: 0) | |
XCTAssertTrue(interactorSpy.didCallExecute) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment