Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
BraisGabin committed Dec 1, 2021
1 parent 2439f08 commit ea9eaad
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
Expand Up @@ -8,8 +8,7 @@ import org.spekframework.spek2.Spek
import org.spekframework.spek2.style.specification.describe

internal class DefaultConfigProviderSpec : Spek({

describe("defaultConfigProvider") {
describe("defaultConfigProvider without plugins") {
val spec by memoized {
createNullLoggingSpec {}
}
Expand All @@ -19,6 +18,33 @@ internal class DefaultConfigProviderSpec : Spek({

assertThat(config.parentPath).isNull()
assertThat(config.subConfig("build").valueOrNull<Int>("maxIssues")).isEqualTo(0)
assertThat(config.valueOrNull<Any>("sample")).isNull()
}

it("copy") {
val path = createTempFileForTest("test", "test")
DefaultConfigProvider().apply { init(spec) }.copy(path)

assertThat(path)
.hasSameTextualContentAs(resourceAsPath("default-detekt-config.yml"))
}
}

describe("defaultConfigProvider without plugins") {
val spec by memoized {
createNullLoggingSpec {
extensions {
fromPaths { listOf(resourceAsPath("sample-rule-set.jar")) }
}
}
}

it("get") {
val config = DefaultConfigProvider().apply { init(spec) }.get()

assertThat(config.parentPath).isNull()
assertThat(config.subConfig("build").valueOrNull<Int>("maxIssues")).isEqualTo(0)
assertThat(config.valueOrNull<Any>("sample")).isNotNull()
}

it("copy") {
Expand Down
Binary file modified detekt-core/src/test/resources/sample-rule-set.jar
Binary file not shown.

0 comments on commit ea9eaad

Please sign in to comment.