Skip to content

Instantly share code, notes, and snippets.

View rozkminiacz's full-sized avatar

Jarosław Michalik rozkminiacz

View GitHub Profile
dependencies {
(...)
testImplementation unitTestDependencies.values()
testImplementation spekDependencies.values()
testImplementation kotlinTestDependencies.values()
}
ext {
def JunitVersion = '4.12'
def KotlinMockitoVersion = '1.5.0'
def SpekVersion = "1.1.5"
unitTestDependencies = [
junit : "junit:junit:${JunitVersion}",
]
class PeopleListPresenter(private val repository: Repository<Person>) : PeopleListContract.Presenter {
var view: PeopleListContract.View? = null
override fun attach(view: PeopleListContract.View) {
this.view = view
loadPeople()
}
private fun loadPeople() {
interface PeopleListContract {
interface View {
fun addPeople(people: List<Person>)
fun showError(throwable: Throwable = Throwable())
fun showLoading()
fun hideLoading()
}
interface Presenter {
fun attach(view: View)
dependencies {
(...)
testImplementation unitTestDependencies.values()
testImplementation spekDependencies.values()
testImplementation kotlinTestDependencies.values()
}
@rozkminiacz
rozkminiacz / PeopleListContract.kt
Created March 12, 2018 08:59
Model View Presenter Writing Spek Specification - gists for blog post
interface PeopleListContract {
interface View {
fun addPeople(people: List<Person>)
fun showError(throwable: Throwable = Throwable())
fun showLoading()
fun hideLoading()
}
interface Presenter {
fun attach(view: View)
on("presenter detach"){
presenter.detach()
it("should dispose observables"){
//
}
}
@rozkminiacz
rozkminiacz / google directions api response
Created February 23, 2018 22:11
google directions api response
{
"geocoded_waypoints" : [
{
"geocoder_status" : "OK",
"place_id" : "EilLcm93b2RlcnNrYSAxMC0xNCwgMzEtMTQxIEtyYWvDs3csIFBvbHNrYQ",
"types" : [ "street_address" ]
},
{
"geocoder_status" : "OK",
"place_id" : "EiNwbGFjIE5vd3kgNCwgMzMtMzMyIEtyYWvDs3csIFBvbHNrYQ",
{
"glossary": {
"title": "example glossary",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",