Last active
October 10, 2017 02:50
-
-
Save omayib/a6943047a408652157e1f3e508c35931 to your computer and use it in GitHub Desktop.
Initiate the RegistrationPresenter object
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
class TheRegistrationPageTests: XCTestCase { | |
override func setUp() { | |
super.setUp() | |
} | |
//... | |
func testRegisterWithEmptyEmail(){ | |
let expec = expectation(description: "registration with empty email") | |
let registrationPresenter = RegistrationPresenter(delegate: MockUIViewController1(expectation: expec)) | |
registrationPresenter.register(email: "", password: "123456789", fullName: "michel jhon", phoneNumber: "087654325673") | |
wait(for: [expec], timeout: 3) | |
} | |
//... | |
} | |
//there are the mock of UIviewController which using the Presenter | |
class MockUIViewController1: RegistrationDelegate{ | |
var expec: XCTestExpectation | |
init(expectation: XCTestExpectation) { | |
self.expec = expectation | |
} | |
func showProgress(){} | |
func hideProgress(){} | |
func registrationDidSucceed(){} | |
func registrationDidFailed(message: String){ | |
XCTAssertEqual(message, "email can't be blank") | |
self.expec.fulfill() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment