Sha256: 4c8bae9be6d41b85529d575d8c2dac17c9f36433002afa28401897569125c931

Contents?: true

Size: 732 Bytes

Versions: 1

Compression:

Stored size: 732 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper.rb'

describe ROXML::XML::Parser do
  before do
    # quiet the error handler
    ROXML::XML::Error.reset_handler
  end
  
  it "should raise on malformed xml" do
    proc { Book.from_xml(fixture(:book_malformed)) }.should raise_error(ROXML::XML::Error)
  end

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

  it "should esape invalid characters for attribute name" do
    node = ROXML::XML::Node.new("attr_holder")
    node.attributes["entities"] = "\"'<>&"
    node.to_s.should == %{<attr_holder entities="&quot;'&lt;&gt;&amp;"/>}
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
roxml-2.5.0 spec/xml/parser_spec.rb