[openSUSE/open-build-service] 1aca8c: Fix broken specs in Kiwi::Image model
Branch: refs/heads/depfu/update/srcapi/flipper-0.24.0 Home: https://github.com/openSUSE/open-build-service Commit: 1aca8cf50f300a1296fec57f085f83a62b2b20bd https://github.com/openSUSE/open-build-service/commit/1aca8cf50f300a1296fec5... Author: Dany Marcoux <dmarcoux@posteo.de> Date: 2022-03-21 (Mon, 21 Mar 2022) Changed paths: M src/api/app/models/kiwi/image/xml_builder.rb M src/api/spec/models/kiwi/image_spec.rb Log Message: ----------- 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.
participants (1)
-
Dany Marcoux