Sha256: f080eccc06bf69c6ee0cad07a3994831fc1d2a8650ca7120ff567a1c985830c5

Contents?: true

Size: 1.68 KB

Versions: 2

Compression:

Stored size: 1.68 KB

Contents

require "#{File.dirname __FILE__}/helper"

class TestLayout < Test::Unit::TestCase
    def test_layout_list
        with_test_site do |site|
            assert_not_nil site.layouts
            assert_equal 2, site.layouts.length
            assert_equal [ :default, :post ], site.layouts.keys.sort { |l,r| l.to_s <=> r.to_s }
            assert_not_nil site.layouts[:default]
            assert_not_nil site.layouts[:post]
        end
    end
    
    class Page
        def title; 'Layout Test'; end
    end
    
    def test_default_layout
        with_test_site do |site|
            src = '<p>Hello World!</p>'
            layout = site.layouts[:default]
            
            assert_render_equal_ref 'test_layout/default_layout.html', layout,
                                    { :content => src, :page => Page.new }, { :right => 'default.html' }
        end
    end
    
    class Post
        def id; 314159; end
        def title; "Test Post"; end
        def uri; "/2009/01/13/test-post.html"; end
        def permalink; "/2009/01/13/test-post.html"; end
        def comments_link; "#{uri}#comments"; end
        def author; "Josh Dady"; end
        def date; "January 13, 2009"; end
        def time?; true; end
        def time; "11:52 AM"; end
        def comments_link; "#{permalink}##comments"; end
        def comment_count; 0; end
    end
    
    def test_post_layout
        with_test_site do |site|
            src = '<p>Hello World!</p>'
            layout = site.layouts[:post]
            
            assert_render_equal_ref 'test_layout/post_layout.html', layout,
                                    { :content => src, :page => Post.new }, { :right => 'post.html' }
        end
    end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
zzot-semi-static-0.0.2 test/test_layout.rb
zzot-zzot-semi-static-0.0.1 test/test_layout.rb