require 'awestruct/engine' require 'awestruct/site' require 'awestruct/page' require 'awestruct/handlers/page_delegating_handler' require 'hashery' describe Awestruct::Handlers::PageDelegatingHandler do before :all do @config = Hashery::OpenCascade[ { :dir=>Pathname.new( File.dirname(__FILE__) + '/test-data/handlers' ) } ] @engine = Awestruct::Engine.new( @config ) @site = @engine.site layout_loader = Awestruct::PageLoader.new( @site, :layouts ) layout = layout_loader.load_page( File.join( @config.dir, 'haml-layout.html.haml' ) ) layout.class.should == Awestruct::Page layout.should_not be_nil @site.layouts << layout layout = layout_loader.load_page( File.join( @config.dir, 'haml-layout-two.html.haml' ) ) layout.class.should == Awestruct::Page layout.should_not be_nil @site.layouts << layout layout = layout_loader.load_page( File.join( @config.dir, 'outer-layout.html.haml' ) ) layout.class.should == Awestruct::Page layout.should_not be_nil @site.layouts << layout end it "should provide layed-out content for the page's content" do inner_page = @engine.load_site_page( "inner-page.html.haml" ) page = Awestruct::Page.new( @site, Awestruct::Handlers::PageDelegatingHandler.new( @site, inner_page) ) c = page.content c.should =~ %r(