Skip to content

Instantly share code, notes, and snippets.

View rozkminiacz's full-sized avatar

Jarosław Michalik rozkminiacz

View GitHub Profile
{
"glossary": {
"title": "example glossary",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",
@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",
on("presenter detach"){
presenter.detach()
it("should dispose observables"){
//
}
}
@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)
dependencies {
(...)
testImplementation unitTestDependencies.values()
testImplementation spekDependencies.values()
testImplementation kotlinTestDependencies.values()
}
interface PeopleListContract {
interface View {
fun addPeople(people: List<Person>)
fun showError(throwable: Throwable = Throwable())
fun showLoading()
fun hideLoading()
}
interface Presenter {
fun attach(view: View)
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() {
ext {
def JunitVersion = '4.12'
def KotlinMockitoVersion = '1.5.0'
def SpekVersion = "1.1.5"
unitTestDependencies = [
junit : "junit:junit:${JunitVersion}",
]
dependencies {
(...)
testImplementation unitTestDependencies.values()
testImplementation spekDependencies.values()
testImplementation kotlinTestDependencies.values()
}
import org.jetbrains.spek.api.Spek
import org.jetbrains.spek.api.dsl.*
import org.junit.platform.runner.JUnitPlatform
import com.nhaarman.mockito_kotlin.*
import org.junit.runner.RunWith
@RunWith(JUnitPlatform::class)
object PeopleListTest : Spek({
given("people exists in repository"){
val view: PeopleListContract.View = mock()