Minitest 5.6.0 breaks tests with JSON/XML responses mocked with OpenStruct



Yesterday my CI system started a-smokin' and a-screamin' and many of the errors were something along these lines:



--- expected
+++ actual
@@ -1 +1 @@
-"<chart><series name=\"Lineups\"><name>56</name><name>614</name><name>0</name></series></chart>"
+"<chart><series name=\"Lineups\"><name>#&lt;struct Minitest::Expectation target=nil, ctx=#&lt;OpenStruct name=\"match day #abc\", value=56&gt;&gt;</name><name>#&lt;struct Minitest::Expectation target=nil, ctx=#&lt;OpenStruct name=\"match day #def\", value=614&gt;&gt;</name><name>#&lt;struct Minitest::Expectation target=nil, ctx=#&lt;OpenStruct name=\"match day #012\", value=0&gt;&gt;</name></series></chart>"


Note that the expected values have been replaced with Minitest::Expectation target=nil. The test for this case is building some sample input:



def build_sample_input
[
OpenStruct.new(
:name => "match day #abc",
:value => 56
),
...
]
end


and the code that's being tested uses the input with Nokogiri and builds some XML output.



builder = Nokogiri::XML::Builder.new do |xml|
process_source(xml)
end

def process_source(xml)
xml.chart do
xml.show_graph_ false
xml.type_ 'line'
xml.orientation_ 'vertical'
xml.description_ 'Unique Lineup Selections'
xml.categories do
input.each do |match_day|
xml.name_ match_day.name
end
end
xml.series('name' => 'Lineups') do
input.each do |match_day|
xml.name_ match_day.value
end
end
end
end


Anyone else run into this? I know it's pretty specific. Bug report is here


No comments:

Post a Comment