[openSUSE/open-build-service] 3a5232: 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: 3a523234088f201e3b192eed35f7a29746b59a9e https://github.com/openSUSE/open-build-service/commit/3a523234088f201e3b192e... Author: Dany Marcoux <dmarcoux@posteo.de> Date: 2022-03-21 (Mon, 21 Mar 2022) Changed paths: 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.
The specs were wrong since the XML generated by the Kiwi::Image#to_xml method is not a document fragment, but a document. It contains a XML declaration, so changing the class solves the issue.
participants (1)
-
Dany Marcoux