Sha256: 9c7cdf077a3d04b5647df3d6c165bf4b77635ccd77c04a9d8bc668d5ec85fe23
Contents?: true
Size: 1.5 KB
Versions: 7
Compression:
Stored size: 1.5 KB
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 node = ROXML::XML::Node.new("entities") node.content = " < > ' \" & " if ROXML::XML_PARSER == 'libxml' node.to_s.should == "<entities> < > ' \" & </entities>" else node.to_s.should == "<entities> < > ' " & </entities>" end end it "should esape invalid characters for attribute name" do node = ROXML::XML::Node.new("attr_holder") node.attributes["entities"] = "\"'<>&" if ROXML::XML_PARSER == 'libxml' node.to_s.should == %{<attr_holder entities=""'<>&"/>} else node.to_s.should == %{<attr_holder entities='"'<>&'/>} end end end describe ROXML::XML::Document do describe "#save" do context "with rexml parser" do it "should defer to existing XMLDecl" do if ROXML::XML_PARSER == 'rexml' @doc = ROXML::XML::Document.new @doc << REXML::XMLDecl.new('1.1') @doc.save('spec/xml/decl_test.xml') ROXML::XML::Parser.parse(File.read('spec/xml/decl_test.xml')).to_s.should == ROXML::XML::Parser.parse(%{<?xml version="1.1"?>}).to_s end end end end end
Version data entries
7 entries across 7 versions & 3 rubygems