Boundary refactor, and add some tests

This commit is contained in:
Bradlee Speice
2014-11-22 17:07:58 -05:00
parent 18d3620da3
commit 05d2d006e4
3 changed files with 70 additions and 82 deletions

View File

@ -0,0 +1,52 @@
package org.bspeice.minimalbible.activity.downloader
import org.jetbrains.spek.api.Spek
import kotlin.test.assertTrue
/**
* Created by bspeice on 11/22/14.
*/
class BookListFragmentSpek : Spek() {{
given("A BookListFragment with showDialog() mocked out") {
class TestableFragment : BookListFragment() {
var condition = false
override fun showDialog() {
condition = true
}
}
val fragment = TestableFragment()
on("attempting to display modules with the dialog not shown already") {
fragment.displayModules(false)
it("should show the download dialog") {
assertTrue(fragment.condition)
}
}
}
given("a BookListFragment with displayLanguageSpinner() mocked out") {
class TestableFragment : BookListFragment() {
var condition = false
override fun displayLanguageSpinner() {
condition = true
}
}
val fragment = TestableFragment()
on("attempting to display modules with the dialog already shown") {
fragment.displayModules(true)
it("should show the available languages spinner") {
assertTrue(fragment.condition)
}
}
}
}
}