shard-kilt/spec/kilt_spec.cr

29 lines
637 B
Crystal
Raw Normal View History

2016-02-14 18:05:54 +00:00
require "./spec_helper"
class View
Kilt.file "spec/fixtures/test.ecr"
end
describe Kilt do
it "renders ecr" do
2016-02-15 03:36:55 +00:00
Kilt.render("spec/fixtures/test.ecr").should eq("<span>#{Process.pid}</span>")
2016-02-14 18:05:54 +00:00
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 engine for extension: \"abc\"") {
2016-02-15 03:36:55 +00:00
Kilt.render("test.abc")
2016-02-14 18:05:54 +00:00
}
end
it "renders registered engine" do
Kilt.register_engine "raw", Raw.embed
Kilt.render("spec/fixtures/test.raw").should eq("Hello World!")
end
2016-02-14 18:05:54 +00:00
end