Skip to content

Commit

Permalink
(#254) Unittest for text_info.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiger committed Feb 24, 2024
1 parent 1800aa2 commit 96c1b98
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/plugin/text_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,11 @@ def TextInfoPlugin.find_iksnr_in_string(string, iksnr)
end

def download_swissmedicinfo_xml(file = nil)
return IO.read(file) if file
if file
content = IO.read(file)
LogFile.debug("Read #{content.size} bytes from #{file}")
return content
end
setup_default_agent
url = "http://download.swissmedicinfo.ch/Accept.aspx?ReturnUrl=%2f"
dir = File.join(ODDB.config.data_dir, 'xml')
Expand Down
1 change: 1 addition & 0 deletions test/test_plugin/text_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def setup
path_check = File.expand_path(File.join(File.dirname(__FILE__), '../../etc', 'barcode_minitest.yml'))
assert_equal(ODDB::TextInfoPlugin::Override_file, path_check)
FileUtils.rm_f(path_check, :verbose => true)
FileUtils.rm_f(File.expand_path('../data/'), :verbose => true)
pointer = flexmock 'pointer'
@aips_download = File.expand_path('../data/xml/Aips_test.xml', File.dirname(__FILE__))
latest_from = File.expand_path('../data/xlsx/Packungen-latest.xlsx', File.dirname(__FILE__))
Expand Down

0 comments on commit 96c1b98

Please sign in to comment.