diff --git a/project/build.scala b/project/build.scala index 7d41538..f29febf 100644 --- a/project/build.scala +++ b/project/build.scala @@ -69,6 +69,9 @@ EclipseKeys.withSource := true, javacOptions in compile ++= Seq("-target", "7", "-source", "7"), 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") ).enablePlugins(SbtTwirl) } diff --git a/src/test/scala/util/DirectorySpec.scala b/src/test/scala/util/DirectorySpec.scala new file mode 100644 index 0000000..d961ea1 --- /dev/null +++ b/src/test/scala/util/DirectorySpec.scala @@ -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 + } + } +}