Commit 67ceaa9d authored by Jonathan Riddell's avatar Jonathan Riddell 🛶

tidy test

parent 3d6d102a
......@@ -2,7 +2,7 @@
# coding: utf-8
# frozen_string_literal: true
# Copyright (C) 2019 Jonathan Riddell <sitter@kde.org>
# Copyright (C) 2019 Jonathan Riddell <jr@jriddell.org>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public
......@@ -38,11 +38,15 @@ class MetaInfoUpdater
@releases_to_show = releases_to_show
end
def date
`date --iso-8601 --date='today'`.chomp!
end
def open_file
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='1.0' date='today'/></releases>")
releases = component.add_child("<releases><release version='#{@version}' date='#{date}'/></releases>")
end
def save_file
......@@ -50,5 +54,6 @@ class MetaInfoUpdater
save_file_name = "#{@filename}.testout" if @testing
f = File.open(save_file_name, "w")
@doc.write_xml_to(f, {indent: 2})
f.close
end
end
This diff is collapsed.
This diff is collapsed.
......@@ -7,6 +7,6 @@ class MetaInfoUpdaterTest < MiniTest::Test
updater.testing = true
updater.open_file
updater.save_file
assert_equal(File.read("data/no-releases.appdata.xml.testout"), File.read("data/no-releases.appdata.xml.good"))
assert_equal(File.read("data/no-releases.appdata.xml.good"), File.read("data/no-releases.appdata.xml.testout"))
end
end
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