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
|
2016-02-15 03:22:35 +00:00
|
|
|
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
|
|
|
|
|
2016-02-15 16:50:18 +00:00
|
|
|
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
|