raniejade
03/28/2018, 10:48 AM2018.1
and it works.robstoll
03/29/2018, 8:33 AMlouiscad
03/29/2018, 11:29 AMmkporwit
03/29/2018, 5:38 PMrrva
04/04/2018, 11:29 AMrrva
04/04/2018, 11:46 AMOleksii Malovanyi
04/04/2018, 1:18 PMOleksii Malovanyi
04/04/2018, 2:29 PMradityagumay
04/07/2018, 4:52 AMradityagumay
04/19/2018, 8:35 AMradityagumay
04/19/2018, 8:36 AMv79
04/20/2018, 6:54 PMmkporwit
04/20/2018, 7:32 PMCzar
04/20/2018, 8:02 PMv79
04/20/2018, 8:10 PMmkporwit
04/20/2018, 9:24 PMradityagumay
04/21/2018, 2:41 AMfetchWeather
and the return have 2 closure success
and error
what is best structure to write it within spek?
currently i did like thisradityagumay
04/21/2018, 2:42 AMinterface WeatherRepository {
fun fetchWeather() : Single<List<Weather>>
}
class WeatherDataStore (private val service: WeatherService) : WeatherRepository {
override fun fetchWeather() : Single<List<Weather>> {
return service.fetchWeather()
.compose(singleIo())
}
}
class WeatherPresenter (private val repository : WeatherRepository) {
fun fetchWeather() {
repository.fetchWeather().subscribe({ success ->
// todo
}, { error ->
// todo
})
}
}
radityagumay
04/21/2018, 2:42 AMclass WeatherPresenterTest : Spek ({
given("a weather presenter") {
val repository = mock<WeatherRepository>()
val view = mock<WeatherView>()
val presenter = WeatherPresenter(repository)
beforeEachTest {
presenter.attachView(view)
}
whenever("fetch weather") {
then("return success") {
repository.fetchWeather() willReturnSingle weatherData // this weatherData from fixture
presenter.fetchWeather()
verify(view).onLoadWeatherSuccess(weatherData)
verifyNoMoreInteraction(view)
}
then("return error") {
repository.fetchWeather() willReturnSingleError weatherDataError // this weatherData from fixture
presenter.fetchWeather()
verify(view).onLoadWeatherError(weatherDataError)
verifyNoMoreInteraction(view)
}
}
afterEachTest {
presenter.detachView()
}
}
})
raniejade
04/23/2018, 10:03 AMkingsley.gomes
04/26/2018, 11:55 AMsatejs
04/30/2018, 9:50 AMpatjackson52
05/11/2018, 3:49 PMrobstoll
05/11/2018, 3:57 PMrook
05/11/2018, 4:34 PMpatjackson52
05/11/2018, 4:37 PMrook
05/11/2018, 4:54 PMrobfletcher
05/11/2018, 4:56 PMrook
05/11/2018, 4:58 PMrobfletcher
05/11/2018, 5:29 PM