spec/innate/helper/partial.rb in manveru-innate-2009.02.06 vs spec/innate/helper/partial.rb in manveru-innate-2009.02.21

- old
+ new

@@ -1,10 +1,10 @@ require 'spec/helper' +Innate.options.app.root = File.dirname(__FILE__) class SpecHelperPartial - include Innate::Node - map '/' + Innate.node '/' def index '<html><head><title><%= render_partial("/title") %></title></head></html>' end @@ -23,22 +23,29 @@ def composed @here = 'there' 'From Action | ' << render_template("partial.erb") end - def recursive(locals = false) - respond render_template('recursive_locals.erb', :n => 1) if locals + def recursive @n = 1 end def without_ext - render_template('title') + render_template('partial') end end -Innate.options.app.root = File.dirname(__FILE__) +class SpecHelperPartialWithLayout < SpecHelperPartial + Innate.node '/with_layout' + layout('layout') + view_root '/' + def layout + '<h1>with layout</h1><%= @content %>' + end +end + describe Innate::Helper::Partial do behaves_like :mock should 'render partials' do get('/').body.should == '<html><head><title>Title</title></head></html>' @@ -59,8 +66,12 @@ should 'work recursively' do get('/recursive').body.gsub(/\s/,'').should == '{1{2{3{44}4}3}2}' end should 'not require file extension' do - get('/without_ext').body.should == 'Title' + get('/without_ext').body.should == "From Partial \n" + end + + should 'render template with layout' do + get('/with_layout/without_ext').body.should == "<h1>with layout</h1>From Partial \n" end end