Sha256: 9e7e6e73c7aa3c2055e6658845414a2eee0c7c0aa5e2bff8f50f571ceb943981

Contents?: true

Size: 898 Bytes

Versions: 22

Compression:

Stored size: 898 Bytes

Contents

require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')

class TestPi < Minitest::Test
  def test_pi
    doc = XML::Smart.open(::File.dirname(__FILE__) + "/EXAMPLE.xml")
    pi = doc.root.add('?tobias', 'dj')
    assert pi.dump == "<?tobias dj?>"
    assert pi.path == "/test/processing-instruction('tobias')"
    assert pi.parent? == true
    assert pi.parent.unique_id == doc.root.unique_id
    assert pi.qname.name == 'tobias'
    assert pi.content == 'dj'
    pi.content = 'vj'
    assert pi.content == 'vj'

    doc.root.add_before('?xsl-stylesheet', 'a="3" b="7"')
    doc.root.children.delete_all!
    assert doc.to_s == "<?xml version=\"1.0\"?>\n<?xsl-stylesheet a=\"3\" b=\"7\"?>\n<test xmlns:soap=\"http://schemas.xmlsoap.org/wsdl/soap/\" xml:lang=\"de\">\n  <?tobias vj?>\n</test>\n"
  end   
end  

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
xml-smart-0.5.3 test/tc_pi.rb
xml-smart-0.5.2 test/tc_pi.rb
xml-smart-0.5.1 test/tc_pi.rb
xml-smart-0.5.0 test/tc_pi.rb
xml-smart-0.4.4 test/tc_pi.rb
xml-smart-0.4.3 test/tc_pi.rb
xml-smart-0.4.2 test/tc_pi.rb
xml-smart-0.4.1 test/tc_pi.rb
xml-smart-0.4.0 test/tc_pi.rb
xml-smart-0.3.22 test/tc_pi.rb
xml-smart-0.3.21 test/tc_pi.rb
xml-smart-0.3.20 test/tc_pi.rb
xml-smart-0.3.19 test/tc_pi.rb
xml-smart-0.3.18 test/tc_pi.rb
xml-smart-0.3.17 test/tc_pi.rb
xml-smart-0.3.16 test/tc_pi.rb
xml-smart-0.3.15 test/tc_pi.rb
xml-smart-0.3.14 test/tc_pi.rb
xml-smart-0.3.12 test/tc_pi.rb
xml-smart-0.3.11 test/tc_pi.rb