Initial commit

This commit is contained in:
Jerome Gravel-Niquet 2016-02-14 13:05:54 -05:00
commit f31dad17d7
12 changed files with 176 additions and 0 deletions

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

@ -0,0 +1 @@
<span><%= Process.pid %></span>

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

@ -0,0 +1 @@
span = Process.pid

27
spec/kilt_spec.cr Normal file
View file

@ -0,0 +1,27 @@
require "./spec_helper"
class View
Kilt.file "spec/fixtures/test.ecr"
end
describe Kilt do
it "renders ecr" do
render_file("spec/fixtures/test.ecr").should eq("<span>#{Process.pid}</span>")
end
it "renders slang" do
render_file("spec/fixtures/test.slang").should eq("<span>#{Process.pid}</span>")
end
it "works with classes" do
View.new.to_s.should eq("<span>#{Process.pid}</span>")
end
it "raises with unsupported filetype" do
expect_raises(Kilt::Exception, "Unsupported template type \"abc\"") {
render_file("test.abc")
}
end
end

9
spec/spec_helper.cr Normal file
View file

@ -0,0 +1,9 @@
require "spec"
require "slang"
require "../src/kilt"
macro render_file(filename)
String.build do |__io__|
Kilt.embed({{filename}}, "__io__")
end
end