Added Mustache adapter

This commit is contained in:
TSUYUSATO Kitsune 2016-02-15 13:18:42 +09:00
parent a222267254
commit ae9e097221
5 changed files with 41 additions and 5 deletions

1
spec/fixtures/test.mustache vendored Normal file
View file

@ -0,0 +1 @@
<span>{{pid}}</span>

26
spec/mustache_spec.cr Normal file
View file

@ -0,0 +1,26 @@
require "./spec_helper"
require "../src/mustache"
class MustacheView
def has_key?(name)
name == "pid"
end
def [](name)
name == "pid" ? Process.pid : nil
end
Kilt.file "spec/fixtures/test.mustache", "__kilt_io__", self
end
describe Kilt do
it "renders ecr" do
Kilt.render("spec/fixtures/test.mustache", { "pid" => Process.pid }).should eq("<span>#{Process.pid}</span>")
end
it "works with classes" do
MustacheView.new.to_s.should eq("<span>#{Process.pid}</span>")
end
end