Skip to content

Instantly share code, notes, and snippets.

@arthur-here
Last active July 13, 2017 12:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arthur-here/1b61e406a38ed07f12e0084a59a299b4 to your computer and use it in GitHub Desktop.
Save arthur-here/1b61e406a38ed07f12e0084a59a299b4 to your computer and use it in GitHub Desktop.
func test_SelectRepository_EmitsShowRepository() {
let repositoryToSelect = RepositoryViewModel(repository: testRepository)
// Create fake observable which fires at 300
let selectRepositoryObservable = testScheduler.createHotObservable([next(300, repositoryToSelect)])
// Bind fake observable to the input
selectRepositoryObservable
.bind(to: viewModel.selectRepository)
.disposed(by: disposeBag)
// Subscribe on the showRepository output and start testScheduler
let result = testScheduler.start { self.viewModel.showRepository.map { $0.absoluteString } }
// Assert that emitted url es equal to the expected one
XCTAssertEqual(result.events, [next(300, "https://www.apple.com")])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment