Sha256: c2328b95df5f038ceb0d7df664163dc040a499297eca5697e2ff4850debc40de

Contents?: true

Size: 1.34 KB

Versions: 3

Compression:

Stored size: 1.34 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe Garterbelt::Doctype do
  before :all do
    @view = MockView.new
  end
  
  describe 'basics' do
    it 'is decends from ClosedTag' do
      Garterbelt::Doctype.ancestors.should include Garterbelt::ClosedTag
    end
    
    it 'has a smaller pool size' do
      Garterbelt::Doctype._pool.max_size.should == 1000
    end
  end
  
  describe 'render' do
    before do
      @view = MockView.new
      @doctype = Garterbelt::Doctype.new(:view => @view, :type => :transitional)
    end
    
    it 'builds the right tag for type = :transitional' do
      tag = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"
      @doctype.render.should include tag
    end
    
    it 'builds the right tag for type = :strict' do
      tag = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
      @doctype.type = :strict
      @doctype.render.should include tag
    end
    
    it 'builds the right tag for type = :html5' do
      tag = '<!DOCTYPE html>'
      @doctype.type = :html5
      @doctype.render.should include tag
    end
    
    it 'indents to the view level' do
      @doctype.render
      @view.output.should match /^\W{4}<!DOCTYPE/
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
garterbelt-0.0.4 spec/renderers/doctype_spec.rb
garterbelt-0.0.3 spec/renderers/doctype_spec.rb
garterbelt-0.0.2 spec/renderers/doctype_spec.rb