Fix broken specs in Kiwi::Image model
Two specs were failing when checking if the subject didn't have errors: ``` Failure/Error: it { expect(subject.errors).to be_empty } expected `[#<Nokogiri::XML::SyntaxError: 1:12: FATAL: XML declaration allowed only at the start of the document>].empty?` to be truthy, got false ./spec/models/kiwi/image_spec.rb:226:in `block (5 levels) in <top (required)>' Failure/Error: expect(subject.errors).to be_empty expected `[#<Nokogiri::XML::SyntaxError: 1:12: FATAL: XML declaration allowed only at the start of the document>].empty?` to be truthy, got false ./spec/models/kiwi/image_spec.rb:279:in `block (4 levels) in <top (required)>' ``` Those errors weren't reported before nokogiri _1.13.0_, as noted in the changelog upstream: > XML::DocumentFragment#errors now correctly contains any parsing errors > encountered. Previously this was always empty. (Note that > HTML::DocumentFragment#errors already did this.) Relying on XML::DocumentFragment was wrong since the XML generated by the Kiwi::Image's to_xml and kiwi_body methods is not a document fragment, but a document. They contain a XML declaration (`<?xml ...?>`), so changing the class solves the issue.
Please register or sign in to comment