From 8dd007b3978d855ee3984b3c3f59b3eb4281b8fa Mon Sep 17 00:00:00 2001 From: Jérémy Zurcher Date: Fri, 6 Jan 2012 10:07:38 +0100 Subject: fix haml engine, add spec --- spec/data/view/node0/engines.haml | 1 + spec/node_spec.rb | 6 ++++++ spec/spec_helper.rb | 8 ++++++++ 3 files changed, 15 insertions(+) create mode 100644 spec/data/view/node0/engines.haml (limited to 'spec') diff --git a/spec/data/view/node0/engines.haml b/spec/data/view/node0/engines.haml new file mode 100644 index 0000000..b9ea984 --- /dev/null +++ b/spec/data/view/node0/engines.haml @@ -0,0 +1 @@ +%h1="Hello world" diff --git a/spec/node_spec.rb b/spec/node_spec.rb index 701c700..3e1c957 100644 --- a/spec/node_spec.rb +++ b/spec/node_spec.rb @@ -199,6 +199,12 @@ describe Zorglub do r = Node0.my_call '/plain_file' r.body[0].should == "plain file\n" end + # + it "haml engine should work" do + r = Node0.my_call '/engines/haml' + r.body[0].should == "

Hello world

\n" + end + # end # end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2e402a5..a531ce9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -12,6 +12,7 @@ require 'yaml' # require 'zorglub' require 'zorglub/engines/file' +require 'zorglub/engines/haml' # HASH_PROC = Proc.new { |path,obj| {:path=>path,:layout=>obj.layout,:view=>obj.view,:args=>obj.args,:map=>obj.map}.to_yaml } STATIC_PROC = Proc.new { |path,obj| ["VAL #{obj.value}",'text/static'] } @@ -79,6 +80,13 @@ class Node0 < Zorglub::Node engine :file ext 'txt' end + def engines name + no_layout + case name + when 'haml' + engine :haml + end + end end # class Node1 < Zorglub::Node -- cgit v1.2.3