Skip to content

Instantly share code, notes, and snippets.

@ruigoncalo
ruigoncalo / DistancesPresenter.kt
Last active September 11, 2017 11:59
Spek with Subjects - Presenter
class DistancesPresenter @Inject constructor(private val roundInteractor: RoundInteractor) {
private val subscriptions by lazy { CompositeSubscription() }
private lateinit var view: View
fun attachView(view: View) {
this.view = view
}
@ruigoncalo
ruigoncalo / DistancesView.kt
Last active September 11, 2017 10:29
Spek with Subjects - View
class DistancesView : FrameLayout, DistancesPresenter.View {
@Inject lateinit var presenter: DistancesPresenter
constructor(context: Context?) : super(context) {
init()
}
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {
init()
@ruigoncalo
ruigoncalo / RoundDistancesPresenterSpec.kt
Last active September 16, 2017 13:55
Spek with Subjects - Spec
@RunWith(JUnitPlatform::class)
class DistancesPresenterSpec : Spek({
rxGroup("DistancePresenter") {
val view: DistancesPresenter.View = mock()
val roundInteractor: RoundInteractor = mock()
val tested = DistancesPresenter(roundInteractor)
var holeSubject: PublishSubject<Hole> = PublishSubject.create()