Sha256: 63564a2579d53b39659fef926a7699eadc1b155bce0e2584fea425bef4ce18b0

Contents?: true

Size: 1.01 KB

Versions: 10

Compression:

Stored size: 1.01 KB

Contents

require 'awestruct/layouts'
require 'awestruct/page'
require 'awestruct/handlers/file_handler'
require 'awestruct/handlers/tilt_handler'

require 'hashery'

describe Awestruct::Layouts do

  it "should be able to index layouts by simple name and output extension" do
    dir = Pathname.new( File.dirname( __FILE__ ) + '/test-data/handlers' )
    site = Hashery::OpenCascade[ { :dir=>dir } ]
    file_handler = Awestruct::Handlers::FileHandler.new( site, File.join( dir, 'haml-layout.html.haml' ) )
    haml_handler = Awestruct::Handlers::TiltHandler.new( site, file_handler )
    page = Awestruct::Page.new( nil, haml_handler )
    
    layouts = Awestruct::Layouts.new
    layouts << page

    located = layouts[0]
    located.should_not be_nil
    located.class.should == Awestruct::Page
    located.simple_name.should == 'haml-layout'

    located = layouts.find_matching( 'haml-layout', '.html' )
    located.should_not be_nil
    located.class.should == Awestruct::Page
    located.simple_name.should == 'haml-layout'
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
awestruct-0.5.4.rc3 spec/layouts_spec.rb
awestruct-0.5.4.rc2 spec/layouts_spec.rb
awestruct-0.5.4.rc spec/layouts_spec.rb
awestruct-0.5.4.beta1 spec/layouts_spec.rb
awestruct-0.5.3 spec/layouts_spec.rb
awestruct-0.5.2.1 spec/layouts_spec.rb
awestruct-0.5.2 spec/layouts_spec.rb
awestruct-0.5.1 spec/layouts_spec.rb
awestruct-0.5.1a spec/layouts_spec.rb
awestruct-0.5.0 spec/layouts_spec.rb