Clean config in test
This commit is contained in:
@@ -7,9 +7,9 @@ object Configuration {
|
||||
private var config = ConfigFactory.load()
|
||||
|
||||
object Sql {
|
||||
val migrationFiles: URI = this::class.java.getResource("/sql/migrations").toURI()
|
||||
val functionFiles: URI = this::class.java.getResource("/sql/functions").toURI()
|
||||
val fixtureFiles: URI = this::class.java.getResource("/sql/fixtures").toURI()
|
||||
val migrationFiles: URI = this::class.java.getResource("/sql/migrations")?.toURI() ?: error("No migrations found")
|
||||
val functionFiles: URI = this::class.java.getResource("/sql/functions")?.toURI() ?: error("No sql function found")
|
||||
val fixtureFiles: URI = this::class.java.getResource("/sql/fixtures")?.toURI() ?: error("No sql fixture found")
|
||||
}
|
||||
object Database {
|
||||
val host: String = config.getString("db.host")
|
||||
|
||||
@@ -32,10 +32,6 @@ class CucumberTest : En, KoinTest {
|
||||
|
||||
init {
|
||||
if (!unitialized) {
|
||||
Configuration.Database.database = "test"
|
||||
Configuration.Database.username = "test"
|
||||
Configuration.Database.password = "test"
|
||||
|
||||
withTestApplication({ module(CUCUMBER) }) {
|
||||
migrations()
|
||||
}
|
||||
@@ -43,9 +39,6 @@ class CucumberTest : En, KoinTest {
|
||||
}
|
||||
|
||||
Before(-1) { _: Scenario ->
|
||||
Configuration.Database.database = "test"
|
||||
Configuration.Database.username = "test"
|
||||
Configuration.Database.password = "test"
|
||||
ktorContext.start()
|
||||
//language=PostgreSQL
|
||||
get<Connection>().sendQuery("start transaction;", listOf())
|
||||
@@ -59,9 +52,6 @@ class CucumberTest : En, KoinTest {
|
||||
}
|
||||
|
||||
private fun migrations() {
|
||||
Configuration.Database.database = "test"
|
||||
Configuration.Database.username = "test"
|
||||
Configuration.Database.password = "test"
|
||||
val migrations: Migrations = get()
|
||||
migrations.forceAllDown()
|
||||
migrations.run()
|
||||
|
||||
Reference in New Issue
Block a user