Commit f201037a authored by Jonathan Riddell's avatar Jonathan Riddell 🛶

update test for limiting releases

parent 249b5a0d
......@@ -46,7 +46,18 @@ class MetaInfoUpdater
abort "No such file" if not File.exists?(@filename)
@doc = File.open(@filename) { |f| Nokogiri::XML(f, &:noblanks) }
component = @doc.at_css("component")
releases = component.add_child("<releases><release version='#{@version}' date='#{date}'/></releases>")
releases = @doc.at_css("releases")
if releases
releases.add_child("<release version='#{@version}' date='#{date}'/>")
else
component.add_child("<releases><release version='#{@version}' date='#{date}'/></releases>")
end
if @releases_to_show > 0
xpath = releases.xpath("//release")
if xpath.length > @releases_to_show
puts "XXX Too many releases!!"
end
end
end
def save_file
......
......@@ -20,19 +20,11 @@
<provides>
<binary>cuttlefish</binary>
</provides>
<releases>
<release version="5.0" date="2019-03-24"/>
</releases>
<releases>
<release version="4.0" date="2019-03-23"/>
</releases>
<releases>
<release version="3.0" date="2019-03-22"/>
</releases>
<releases>
<release version="2.0" date="2019-03-21"/>
</releases>
<releases>
<release version="1.0" date="2019-03-20"/>
<release version="2.0" date="2019-03-21"/>
<release version="3.0" date="2019-03-22"/>
<release version="4.0" date="2019-03-23"/>
<release version="5.0" date="2018-01-01"/>
</releases>
</component>
......@@ -20,19 +20,10 @@
<provides>
<binary>cuttlefish</binary>
</provides>
<releases>
<release version="5.0" date="2019-03-24"/>
</releases>
<releases>
<release version="4.0" date="2019-03-23"/>
</releases>
<releases>
<release version="3.0" date="2019-03-22"/>
</releases>
<releases>
<release version="2.0" date="2019-03-21"/>
</releases>
<releases>
<release version="1.0" date="2019-03-20"/>
<release version="4.0" date="2019-03-23"/>
<release version="5.0" date="2018-01-01"/>
<release version="6.0" date="2018-01-01"/>
</releases>
</component>
......@@ -22,8 +22,6 @@
</provides>
<releases>
<release version="1.0" date="2019-03-20"/>
</releases>
<releases>
<release version="2.0" date="2018-01-01"/>
</releases>
</component>
......@@ -24,9 +24,8 @@ class MetaInfoUpdaterTest < MiniTest::Test
# adding a release to a file with 5 releases and limit set to 4
def test_five_releases
skip
file = "five-releases"
updater = MetaInfoUpdater.new("data/#{file}.appdata.xml", "1.0", "2018-01-01", 4)
updater = MetaInfoUpdater.new("data/#{file}.appdata.xml", "6.0", "2018-01-01", 4)
updater.testing = true
updater.open_file
updater.save_file
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment