add test for Diretory (set GitBucketHome when test scope)

This commit is contained in:
nazoking
2015-02-26 11:47:47 +09:00
parent d47ccf587c
commit 3057a31a6c
2 changed files with 17 additions and 0 deletions

View File

@@ -69,6 +69,9 @@ object MyBuild extends Build {
EclipseKeys.withSource := true, EclipseKeys.withSource := true,
javacOptions in compile ++= Seq("-target", "7", "-source", "7"), javacOptions in compile ++= Seq("-target", "7", "-source", "7"),
testOptions in Test += Tests.Argument(TestFrameworks.Specs2, "junitxml", "console"), testOptions in Test += Tests.Argument(TestFrameworks.Specs2, "junitxml", "console"),
javaOptions in Test += "-Dgitbucket.home=target/gitbucket_home_for_test",
testOptions in Test += Tests.Setup( () => new java.io.File("target/gitbucket_home_for_test").mkdir() ),
fork in Test := true,
packageOptions += Package.MainClass("JettyLauncher") packageOptions += Package.MainClass("JettyLauncher")
).enablePlugins(SbtTwirl) ).enablePlugins(SbtTwirl)
} }

View File

@@ -0,0 +1,14 @@
package util
import org.specs2.mutable._
class DirectorySpec extends Specification {
"GitBucketHome" should {
"set under target in test scope" in {
Directory.GitBucketHome mustEqual new java.io.File("target/gitbucket_home_for_test").getAbsolutePath
}
"exists" in {
new java.io.File(Directory.GitBucketHome).exists
}
}
}