From 8d9a40f6cc67e65aaeef1cfe52cfe1907c80108e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 5 Jan 2012 15:41:34 +0100 Subject: spec: add file angine and ext definition specs --- spec/data/view/node0/plain_file.txt | 1 + spec/data/view/node0/xml_file.xml | 1 + spec/node_spec.rb | 7 +++++++ spec/spec_helper.rb | 11 +++++++++++ 4 files changed, 20 insertions(+) create mode 100644 spec/data/view/node0/plain_file.txt create mode 100644 spec/data/view/node0/xml_file.xml diff --git a/spec/data/view/node0/plain_file.txt b/spec/data/view/node0/plain_file.txt new file mode 100644 index 0000000..c6817f7 --- /dev/null +++ b/spec/data/view/node0/plain_file.txt @@ -0,0 +1 @@ +plain file diff --git a/spec/data/view/node0/xml_file.xml b/spec/data/view/node0/xml_file.xml new file mode 100644 index 0000000..97af101 --- /dev/null +++ b/spec/data/view/node0/xml_file.xml @@ -0,0 +1 @@ +file diff --git a/spec/node_spec.rb b/spec/node_spec.rb index 6c83a13..23fd379 100644 --- a/spec/node_spec.rb +++ b/spec/node_spec.rb @@ -192,6 +192,13 @@ describe Zorglub do vars.should == ['js0','js1'] vars[2].should be_nil end + # + it "ext definition and file engine should work" do + r = Node0.my_call '/xml_file' + r.body[0]='file' + r = Node0.my_call '/plain_file' + r.body[0]='plain text' + end end # end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8d7a9bd..2e402a5 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -11,6 +11,7 @@ end require 'yaml' # require 'zorglub' +require 'zorglub/engines/file' # 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'] } @@ -68,6 +69,16 @@ class Node0 < Zorglub::Node def do_redirect redirect r(:do_partial,1,2,3) end + def xml_file + no_layout + engine :file + ext 'xml' + end + def plain_file + no_layout + engine :file + ext 'txt' + end end # class Node1 < Zorglub::Node -- cgit v1.1-2-g2b99