mirror of
https://gitea.invidious.io/iv-org/shard-kilt.git
synced 2024-08-15 00:43:15 +00:00
Added slang adapter + specs, reorganized specs and adapters
This commit is contained in:
parent
ae9e097221
commit
b152bf1153
14 changed files with 62 additions and 27 deletions
1
spec/fixtures/test.slang
vendored
Normal file
1
spec/fixtures/test.slang
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
span = Process.pid
|
|
@ -1,5 +1,5 @@
|
|||
require "./spec_helper"
|
||||
require "../src/mustache"
|
||||
require "../spec_helper"
|
||||
require "../../src/kilt/crustache"
|
||||
|
||||
class MustacheView
|
||||
def has_key?(name)
|
||||
|
@ -13,9 +13,9 @@ class MustacheView
|
|||
Kilt.file "spec/fixtures/test.mustache", "__kilt_io__", self
|
||||
end
|
||||
|
||||
describe Kilt do
|
||||
describe "kilt/crustache" do
|
||||
|
||||
it "renders ecr" do
|
||||
it "renders crustache" do
|
||||
Kilt.render("spec/fixtures/test.mustache", { "pid" => Process.pid }).should eq("<span>#{Process.pid}</span>")
|
||||
end
|
||||
|
18
spec/kilt/slang_spec.cr
Normal file
18
spec/kilt/slang_spec.cr
Normal file
|
@ -0,0 +1,18 @@
|
|||
require "../spec_helper"
|
||||
require "../../src/kilt/slang"
|
||||
|
||||
class SlangView
|
||||
Kilt.file "spec/fixtures/test.slang"
|
||||
end
|
||||
|
||||
describe "kilt/slang" do
|
||||
|
||||
it "renders slang" do
|
||||
Kilt.render("spec/fixtures/test.slang").should eq("<span>#{Process.pid}</span>")
|
||||
end
|
||||
|
||||
it "works with classes" do
|
||||
SlangView.new.to_s.should eq("<span>#{Process.pid}</span>")
|
||||
end
|
||||
|
||||
end
|
|
@ -10,11 +10,6 @@ describe Kilt do
|
|||
Kilt.render("spec/fixtures/test.ecr").should eq("<span>#{Process.pid}</span>")
|
||||
end
|
||||
|
||||
it "renders registered engine" do
|
||||
Kilt.register_engine "raw", Raw.embed
|
||||
Kilt.render("spec/fixtures/test.raw").should eq("Hello World!")
|
||||
end
|
||||
|
||||
it "works with classes" do
|
||||
View.new.to_s.should eq("<span>#{Process.pid}</span>")
|
||||
end
|
||||
|
@ -25,4 +20,9 @@ describe Kilt do
|
|||
}
|
||||
end
|
||||
|
||||
it "renders registered engine" do
|
||||
Kilt.register_engine "raw", Raw.embed
|
||||
Kilt.render("spec/fixtures/test.raw").should eq("Hello World!")
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
require "spec"
|
||||
require "../src/kilt"
|
||||
|
||||
module Raw
|
||||
macro embed(filename, io)
|
||||
{{ io.id }} << {{`cat #{filename}`.stringify}}
|
||||
end
|
||||
end
|
||||
require "./support/raw_engine"
|
5
spec/support/raw_engine.cr
Normal file
5
spec/support/raw_engine.cr
Normal file
|
@ -0,0 +1,5 @@
|
|||
module Raw
|
||||
macro embed(filename, io)
|
||||
{{ io.id }} << {{`cat #{filename}`.stringify}}
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue