Skip to content

Commit

Permalink
Small changes to be able to run under Ruby 2.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiger committed Jan 16, 2018
1 parent afdff03 commit dcf394b
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 7 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -3,6 +3,7 @@ gem 'dbi', :git => 'https://github.com/ngiger/ruby-dbi'

gem 'syck'

gem 'mathn'
gem 'minitar'
gem 'bigdecimal'#, '1.1.0'
gem 'builder'
Expand Down
4 changes: 3 additions & 1 deletion Gemfile.lock
Expand Up @@ -73,6 +73,7 @@ GEM
json (1.8.6)
mail (2.7.0)
mini_mime (>= 0.1.1)
mathn (0.1.0)
mechanize (2.7.5)
domain_name (~> 0.5, >= 0.5.1)
http-cookie (~> 1.0)
Expand Down Expand Up @@ -265,6 +266,7 @@ DEPENDENCIES
i18n (= 0.6.9)
json
mail (= 2.7.0)
mathn
mechanize
mime-types
minitar
Expand Down Expand Up @@ -317,4 +319,4 @@ DEPENDENCIES
yus

BUNDLED WITH
1.16.0
1.16.1
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Expand Up @@ -3,6 +3,8 @@
# require 'simplecov'
# SimpleCov.start

require 'date'

RSpec.configure do |config|
config.mock_with :flexmock
config.expect_with :rspec do |c|
Expand Down
4 changes: 4 additions & 0 deletions src/plugin/refdata_jur.rb
Expand Up @@ -306,6 +306,10 @@ def store_company(data, gln, ba_type)
def parse_xml(path)
log "parse_xml #{path} #{File.size(path)} bytes"
xml = IO.read(path)
if defined?(Minitest) && xml.size > 100*1024
$stdout.puts "File #{path} way too big #{File.size(path)}"
require 'pry'; binding.pry
end
items = Ox.load(xml, mode: :hash_no_attrs)[:"soap:Envelope"][:"soap:Body"][:PARTNER][:ITEM]
@info_to_gln = {}
items.each_with_index do |item, index|
Expand Down
4 changes: 4 additions & 0 deletions src/plugin/refdata_nat.rb
Expand Up @@ -290,6 +290,10 @@ def store_doctor(data, gln)
def parse_xml(path)
log "parsing #{path} #{File.size(path)} bytes"
xml = IO.read(path)
if defined?(Minitest) && xml.size > 100*1024
$stdout.puts "File #{path} way too big #{File.size(path)}"
require 'pry'; binding.pry
end
items = Ox.load(xml, mode: :hash_no_attrs)[:"soap:Envelope"][:"soap:Body"][:PARTNER][:ITEM]
@info_to_gln = {}
items.each_with_index do |item, index|
Expand Down
1 change: 1 addition & 0 deletions src/util/today.rb
@@ -1,6 +1,7 @@
#!/usr/bin/env ruby
# encoding: utf-8
# @@today -- oddb.org -- 11.07.2007 -- hwyss@ywesee.com
require 'date'

class Object
unless(defined?(@@date_arithmetic_optimization))
Expand Down
3 changes: 1 addition & 2 deletions src/view/drugs/compare.rb
Expand Up @@ -77,7 +77,6 @@ def reorganize_components
}
end
def active_agents(model, session)
$stdout.puts "compore active_agents #{model.class}"
model.active_agents.join(',<br>')
end
def compose_empty_list(offset)
Expand All @@ -98,7 +97,7 @@ def package_line(offset)
end
def price_difference(model, session)
if(diff = model.price_difference)
sprintf('%+d%', diff*100.0)
sprintf('%+d%%', diff*100.0)
end
end
def sort_model
Expand Down
18 changes: 14 additions & 4 deletions test/test_util/updater.rb
Expand Up @@ -129,6 +129,18 @@ def setup_bsv_xml_plugin
klass.should_receive(:new).and_return(bsv)
end
end
def setup_refdata_jur_plugin
refdata = flexmock('setup_refdata_jur_plugin') do |plug|
plug.should_receive(:update).and_return('update')
plug.should_receive(:_update).and_return('_update')
plug.should_receive(:change_flags).and_return({})
plug.should_receive(:log_info_bsv).and_return(@recipients)
plug.should_receive(:log_info).and_return(@recipients)
end
flexstub(ODDB::Companies::RefdataJurPlugin) do |klass|
klass.should_receive(:new).and_return(refdata)
end
end
def setup_exporter
plugin = flexmock('plugin') do |plg|
plg.should_receive(:log_info).and_return(@recipients)
Expand Down Expand Up @@ -231,6 +243,7 @@ def setup_update_notify_simple(klass, *methods)
end
end
def setup_update_swissmedic_followers
setup_refdata_jur_plugin
setup_bsv_xml_plugin
log = flexmock('log') do |log|
log.should_receive(:change_flags).and_return({'ptr' => ['flgs']})
Expand Down Expand Up @@ -274,6 +287,7 @@ def setup_update_swissmedic
end
end
def setup_update_bsv_followers
setup_refdata_jur_plugin
setup_update_immediate(LppvPlugin) # for update_lppv
flexstub(RssPlugin) do |klass| # for update_price_feeds
klass.should_receive(:new).and_return(flexmock('rss') do |obj|
Expand Down Expand Up @@ -480,10 +494,6 @@ def test_update_doctors
setup_update_simple(ODDB::Doctors::DoctorPlugin)
assert_equal('notify', @updater.update_doctors)
end
def test_update_hospitals
setup_update_simple(HospitalPlugin)
assert_equal('notify', @updater.update_hospitals)
end
def test_update_lppv
setup_update_immediate(LppvPlugin)
assert_equal('notify', @updater.update_lppv)
Expand Down

0 comments on commit dcf394b

Please sign in to comment.