Sha256: 7b698e015289a1bb4f250ac3cc2848fa5b31b4138fe922be2c505b0a7edecc69
Contents?: true
Size: 1.27 KB
Versions: 9
Compression:
Stored size: 1.27 KB
Contents
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'lib') require 'test/unit' require 'glue/builder/xml' class TC_BuildersXml < Test::Unit::TestCase # :nodoc: all include Glue def test_string x = XmlBuilder.new x.start_tag!('html'). start_tag!('title').text!('hello').end_tag!('title'). end_tag!('html') assert_equal '<html><title>hello</title></html>', x.buffer end def test_missing x = XmlBuilder.new x.b('This is bold') assert_equal '<b>This is bold</b>', x.buffer x = XmlBuilder.new x.a('Navel', :href => 'http://www.navel.gr') assert_equal '<a href="http://www.navel.gr">Navel</a>', x.buffer x = XmlBuilder.new x.b { x.i 'Hello', :class =>'new' x.p 'Paragraph' } assert_equal '<b><i class="new">Hello</i><p>Paragraph</p></b>', x.buffer x = XmlBuilder.new x.hr assert_equal '<hr />', x.buffer x = XmlBuilder.new x.hr(:style => 'height: 1px') assert_equal '<hr style="height: 1px" />', x.buffer end def test_xml_builder buffer = '' x = XmlBuilder.new(buffer) x.start_tag!('html'). start_tag!('title').text!('hello').end_tag!('title'). end_tag!('html') assert_equal '<html><title>hello</title></html>', buffer end end
Version data entries
9 entries across 9 versions & 1 rubygems