Skip to content

Instantly share code, notes, and snippets.

@omayib
Last active October 10, 2017 02:50
Show Gist options
  • Save omayib/a6943047a408652157e1f3e508c35931 to your computer and use it in GitHub Desktop.
Save omayib/a6943047a408652157e1f3e508c35931 to your computer and use it in GitHub Desktop.
Initiate the RegistrationPresenter object
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