Sha256: ea6a08929bbaf0c9f49f4045d405116d2a8c2b85954bcaa3dea924f9e3be6349

Contents?: true

Size: 724 Bytes

Versions: 6

Compression:

Stored size: 724 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', "helper"))

module Nokogiri
  module XML
    class TestBuilder < Nokogiri::TestCase
      def test_cdata
        builder = Nokogiri::XML::Builder.new do
          root {
            cdata "hello world"
          }
        end
        assert_equal("<?xml version=\"1.0\"?><root><![CDATA[hello world]]></root>", builder.to_xml.gsub(/\n/, ''))
      end

      def test_builder_no_block
        string = "hello world"
        builder = Nokogiri::XML::Builder.new
        builder.root {
          cdata string
        }
        assert_equal("<?xml version=\"1.0\"?><root><![CDATA[hello world]]></root>", builder.to_xml.gsub(/\n/, ''))
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nokogiri-1.2.2 test/xml/test_builder.rb
nokogiri-1.2.2-java test/xml/test_builder.rb
nokogiri-1.2.2-x86-mswin32-60 test/xml/test_builder.rb
nokogiri-1.2.3-java test/xml/test_builder.rb
nokogiri-1.2.3 test/xml/test_builder.rb
nokogiri-1.2.3-x86-mswin32-60 test/xml/test_builder.rb