File: parser_spec.rb

package info (click to toggle)
ruby-roxml 3.3.1-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 772 kB
  • ctags: 532
  • sloc: ruby: 4,066; xml: 1,013; makefile: 6
file content (15 lines) | stat: -rw-r--r-- 546 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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, " < > ' \" & ")
    node.to_s.should == "<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", "\"'<>&")
    node.to_s.should == %{<attr_holder entities="&quot;'&lt;&gt;&amp;"/>}
  end
end