Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

unit test impl

  • Loading branch information...
commit 503d19a926de73a58b92e889ca67c0ba1140408a 1 parent fb31acf
@wfaler authored
View
9 src/main/scala/com/recursivity/sitegen/Model.scala
@@ -1,8 +1,9 @@
package com.recursivity.sitegen
+
import java.io.{File, FileInputStream}
import java.util.Properties
-import scala.io.Source
import scala.collection.mutable.HashMap
+import scala.io.Source
object SiteGenerator extends App{
val inputDir = args(0)
@@ -95,7 +96,11 @@ sealed trait Page extends SiteArtifact{
}
- def render: String = {
+ def renderPage: String = {
+ null
+ }
+
+ def renderContent: String = {
TemplateRenderer.apply(this.uri, this.settings.map(_.model).getOrElse(Map[String, Any]()))
}
}
View
5 src/main/scala/com/recursivity/sitegen/Settings.scala
@@ -27,7 +27,10 @@ object Settings{
object DirectorySettings{
def apply(properties: Map[String, String], workingDir: File, parentSettings: Option[Settings]): Settings = {
- null
+ val settings = Settings(properties, workingDir)
+ parentSettings.map(parent => {
+ null
+ }).getOrElse(settings)
}
}
View
15 src/test/scala/com/recursivity/sitegen/SettingsSpec.scala
@@ -9,9 +9,18 @@ class SettingsSpec extends Specification with ThrownExpectations{
def is = {
"The Settings should" ^
p^
- "Settings should build correctly" !pending^
- "DirectorySettings should traverse apply child-settings and only leave parent settings where missing in child-settings" !pending^
- "Parent settings applied to existing settings should fill in properties not in existing settings" !pending^
+ "DirectorySettings should traverse apply child-settings and only leave parent settings where missing in child-settings" !directorySettings^
end
}
+
+ def directorySettings = {
+ val dir = new File("site")
+ val parent = DirectorySettings(Map("parent" -> "layout/layout.mustache", "shared" -> "\"yes\"", "parentDirectory" -> "\"yes\""), dir, None)
+ val child = DirectorySettings(Map("parent" -> "layout/htmlLayout.mustache", "shared" -> "\"maybe\"", "isChild" -> "\"true\""), dir, Some(parent))
+
+
+
+ 1 must be_==(1)
+ }
+
}
Please sign in to comment.
Something went wrong with that request. Please try again.