Sha256: 11ba8fa50aadd12e1c520c184c2bfacfd0955179e0e8c7195b3150ff3deba841

Contents?: true

Size: 1.16 KB

Versions: 7

Compression:

Stored size: 1.16 KB

Contents

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

describe Quarto::HtmlTransformer do
	include Quarto::REXMLMatchers
	
	context '#transform' do
		before :each do
			@html = REXML::Document.new(%Q(
				<description>
					<p id="first_paragraph">Mega-lo-Mart is a parody of big-box stores featured in <cite>King of the Hill</cite>.</p>
				
					<p id="second_paragraph">It is featured in Wikipedia's
						<a href="http://en.wikipedia.org/wiki/List_of_fictional_companies">List&nbsp;of&nbsp;Fictional&nbsp;Companies.</a>
					</p>
				</description>
			))
			@t = Quarto::HtmlTransformer.new
		end
		
		it 'should return valid HTML verbatim, even if the root element is not a valid HTML element' do
			output = @t.transform(@html.root)
			output = REXML::Document.new('<description>' + output + '</description>')
			output.should have_element('p', :attributes => {'id' => 'first_paragraph'})
			output.should have_element('cite', :text => 'King of the Hill')
			output.should have_element('p', :attributes => {'id' => 'second_paragraph'})
			output.should have_element('a', :attributes => {'href' => 'http://en.wikipedia.org/wiki/List_of_fictional_companies'})
		end
	end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
jarrett-quarto-1.4.1 spec/html_tranformer_spec.rb
jarrett-quarto-1.5.0 spec/html_tranformer_spec.rb
jarrett-quarto-1.5.1 spec/html_tranformer_spec.rb
jarrett-quarto-1.6.0 spec/html_tranformer_spec.rb
jarrett-quarto-1.6.1 spec/html_tranformer_spec.rb
jarrett-quarto-1.6.2 spec/html_tranformer_spec.rb
jarrett-quarto-1.6.3 spec/html_tranformer_spec.rb