refactor: TemplateLoader to protocol, follow Swift API guidelines
This commit is contained in:
@@ -6,18 +6,18 @@ import PathKit
|
||||
func testTemplateLoader() {
|
||||
describe("TemplateLoader") {
|
||||
let path = Path(#file) + ".." + "fixtures"
|
||||
let loader = TemplateLoader(paths: [path])
|
||||
let loader = FileSystemLoader(paths: [path])
|
||||
|
||||
$0.it("returns nil when a template cannot be found") {
|
||||
try expect(loader.loadTemplate("unknown.html")).to.beNil()
|
||||
try expect(try loader.loadTemplate(name: "unknown.html")).to.beNil()
|
||||
}
|
||||
|
||||
$0.it("returns nil when an array of templates cannot be found") {
|
||||
try expect(loader.loadTemplate(["unknown.html", "unknown2.html"])).to.beNil()
|
||||
try expect(try loader.loadTemplate(names: ["unknown.html", "unknown2.html"])).to.beNil()
|
||||
}
|
||||
|
||||
$0.it("can load a template from a file") {
|
||||
if loader.loadTemplate("test.html") == nil {
|
||||
if try loader.loadTemplate(name: "test.html") == nil {
|
||||
throw failure("didn't find the template")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user