lundi 23 novembre 2015

Unit testing UITextField with ReactiveCocoa

I'm writing a unit test that ensures changes in a UITextField are reflected in my app's ViewModel.

func testViewToViewModelCommunication(){
    viewController.originalTextField.text="test"
    XCTAssertEqual(viewController.originalTextField.text, viewModel.originalText)
}

The test fails. Because the app is working in practice, I believe this testing code doesn't trigger the appropriate ReactiveCocoa methods. My guess is that the ="test" line isn't the proper way to manually set the text in ReactiveCocoa. What's the right way to do this?

Aucun commentaire:

Enregistrer un commentaire