mirror of
https://gitea.invidious.io/iv-org/shard-kilt.git
synced 2024-08-15 00:43:15 +00:00
Add jbuilder (#20)
This commit is contained in:
parent
43a5c472a6
commit
7603087d3d
4 changed files with 25 additions and 0 deletions
|
@ -15,3 +15,5 @@ development_dependencies:
|
||||||
github: f/temel
|
github: f/temel
|
||||||
liquid:
|
liquid:
|
||||||
github: TechMagister/liquid.cr
|
github: TechMagister/liquid.cr
|
||||||
|
jbuilder:
|
||||||
|
github: shootingfly/jbuilder
|
||||||
|
|
1
spec/fixtures/test.jbuilder
vendored
Normal file
1
spec/fixtures/test.jbuilder
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
json.span Process.pid
|
18
spec/kilt/jbuilder_spec.cr
Normal file
18
spec/kilt/jbuilder_spec.cr
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
require "../spec_helper"
|
||||||
|
require "../../src/jbuilder"
|
||||||
|
|
||||||
|
class JbuilderView
|
||||||
|
Kilt.file "spec/fixtures/test.jbuilder"
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "kilt/jbuilder" do
|
||||||
|
|
||||||
|
it "renders jbuilder" do
|
||||||
|
Kilt.render("spec/fixtures/test.jbuilder").should eq("{\"span\":#{Process.pid}}")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "works with class" do
|
||||||
|
JbuilderView.new.to_s.should eq("{\"span\":#{Process.pid}}")
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
4
src/jbuilder.cr
Normal file
4
src/jbuilder.cr
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
require "./kilt"
|
||||||
|
require "jbuilder"
|
||||||
|
|
||||||
|
Kilt.register_engine "jbuilder", Jbuilder.embed
|
Loading…
Reference in a new issue