Sha256: d9371de4bcbc03d043bc2061010ac7dadde1e7baa8d8a09aa08bf64bf79138e6

Contents?: true

Size: 556 Bytes

Versions: 4

Compression:

Stored size: 556 Bytes

Contents

require_relative './../spec_helper.rb'

describe ROXML::XML do
  it "should escape invalid characters on output to text node" do
    node = ROXML::XML.new_node("entities")
    ROXML::XML.set_content(node, " < > ' \" & ")
    expect(node.to_s).to eq("<entities> &lt; &gt; ' \" &amp; </entities>")
  end

  it "should esape invalid characters for attribute name" do
    node = ROXML::XML.new_node("attr_holder")
    ROXML::XML.set_attribute(node, "entities", "\"'<>&")
    expect(node.to_s).to eq(%{<attr_holder entities="&quot;'&lt;&gt;&amp;"/>})
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
roxml-4.2.0 spec/xml/parser_spec.rb
roxml-4.1.1 spec/xml/parser_spec.rb
roxml-4.1.0 spec/xml/parser_spec.rb
roxml-4.0.0 spec/xml/parser_spec.rb