require 'spec_helper' RSpec.describe 'Doctype rendering', type: :render do context 'with html format' do it 'renders html5 doctype by default' do expect(render_string('!!!')).to eq("\n") end it 'renders xml doctype (silent)' do expect(render_string('!!! xml')).to eq("\n") end end context 'with html4 format' do it 'renders transitional doctype by default' do expect(render_string('!!!', format: :html4)).to eq(%Q|\n|) end it 'renders frameset doctype' do expect(render_string('!!! frameset', format: :html4)).to eq(%Q|\n|) end it 'renders strict doctype' do expect(render_string('!!! strict', format: :html4)).to eq(%Q|\n|) end end context 'with xhtml format' do it 'renders transitional doctype by default' do expect(render_string('!!!', format: :xhtml)).to eq(%Q|\n|) end it 'renders xml doctype' do expect(render_string('!!! xml', format: :xhtml)).to eq("\n") end it 'renders xhtml 1.1 doctype' do expect(render_string('!!! 1.1', format: :xhtml)).to eq(%Q|\n|) end it 'renders xhtml mobile doctype' do expect(render_string('!!! mobile', format: :xhtml)).to eq(%Q|\n|) end it 'renders xhtml basic doctype' do expect(render_string('!!! basic', format: :xhtml)).to eq(%Q|\n|) end it 'renders xhtml frameset doctype' do expect(render_string('!!! frameset', format: :xhtml)).to eq(%Q|\n|) end it 'renders html 5 doctype with xhtml syntax' do expect(render_string('!!! 5', format: :xhtml)).to eq(%Q|\n|) end end it 'raises error when doctype has children' do expect { render_string(<