Sha256: 80bfaa1c66f9cd0304c48d2461ed49a48b5e91763d27be38d241cee2028fabe0

Contents?: true

Size: 1.24 KB

Versions: 7

Compression:

Stored size: 1.24 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
  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

7 entries across 7 versions & 1 rubygems

Version Path
garterbelt-0.1.1 spec/renderers/doctype_spec.rb
garterbelt-0.1.0 spec/renderers/doctype_spec.rb
garterbelt-0.0.9 spec/renderers/doctype_spec.rb
garterbelt-0.0.8 spec/renderers/doctype_spec.rb
garterbelt-0.0.7 spec/renderers/doctype_spec.rb
garterbelt-0.0.6 spec/renderers/doctype_spec.rb
garterbelt-0.0.5 spec/renderers/doctype_spec.rb