spec/extractor_spec.rb in oddb2xml-2.2.3 vs spec/extractor_spec.rb in oddb2xml-2.2.4

- old
+ new

@@ -1,11 +1,11 @@ # encoding: utf-8 require 'spec_helper' require "#{Dir.pwd}/lib/oddb2xml/downloader" ENV['TZ'] = 'UTC' # needed for last_change - +LAST_CHANGE = "2015-07-03 00:00:00 +0000" describe Oddb2xml::BMUpdateExtractor do before(:all) { VCR.eject_cassette; VCR.insert_cassette('oddb2xml') } after(:all) { VCR.eject_cassette } before(:all) { VCR.eject_cassette; VCR.insert_cassette('oddb2xml') @@ -49,10 +49,12 @@ end describe Oddb2xml::RefdataExtractor do before(:all) { VCR.eject_cassette; VCR.insert_cassette('oddb2xml') } after(:all) { VCR.eject_cassette } + @@last_change = '2015-09-09 00:00:00 +0000' + context 'should handle pharma articles' do subject do @downloader = Oddb2xml::RefdataDownloader.new({}, :pharma) xml = @downloader.download @pharma_items = Oddb2xml::RefdataExtractor.new(xml, 'PHARMA').to_hash @@ -65,11 +67,11 @@ expect(item_found).not_to be nil expected = { :refdata=>true, :_type=>:pharma, :ean=> Oddb2xml::LEVETIRACETAM_GTIN.to_i, :pharmacode=> pharma_code_LEVETIRACETAM, - :last_change => "2015-06-04 00:00:00 +0000", + :last_change => @@last_change, :desc_de=>"LEVETIRACETAM DESITIN Mini Filmtab 250 mg 30 Stk", :desc_fr=>"LEVETIRACETAM DESITIN mini cpr pel 250 mg 30 pce", :atc_code=>"N03AX14", :company_name=>"Desitin Pharma GmbH", :company_ean=>"7601001320451"} @@ -91,11 +93,11 @@ expect(item_found).not_to be nil expected = {:refdata=>true, :_type=>:nonpharma, :ean=>7611600441020, :pharmacode=>pharma_code_TUBEGAZE, - :last_change => "2015-06-04 00:00:00 +0000", + :last_change => @@last_change, :desc_de=>"TUBEGAZE Verband weiss Nr 12 20m Finger gross", :desc_fr=>"TUBEGAZE pans tubul blanc Nr 12 20m doigts grands", :atc_code=>"", :company_name=>"IVF HARTMANN AG", :company_ean=>"7601001000896"} @@ -147,13 +149,12 @@ end context 'builds fachfinfo' do it { xml = @downloader.download @infos = Oddb2xml::SwissmedicInfoExtractor.new(xml).to_hash - expect(@infos.keys).to eq ['de', 'fr'] - expect(@infos['de'].size).to eq 5 - expect(@infos['fr'].size).to eq 2 + expect(@infos.keys).to eq ['de'] + expect(@infos['de'].size).to eq 2 levetiracetam = nil @infos['de'].each{|info| levetiracetam = info if /Levetiracetam/.match(info[:name]) } expect(levetiracetam[:owner]).to eq('Desitin Pharma GmbH') @@ -173,11 +174,11 @@ context 'can parse swissmedic_package.xlsx' do it { cleanup_directories_before_run filename = File.join(Oddb2xml::SpecData, 'swissmedic_package.xlsx') @packs = Oddb2xml::SwissmedicExtractor.new(filename, :package).to_hash - expect(@packs.size).to eq(17) + expect(@packs.size).to eq(15) serocytol = nil @packs.each{|pack| serocytol = pack[1] if pack[1][:ean] == '7680620690084' } expect(serocytol[:atc_code]).to eq('N03AX14') @@ -329,7 +330,6 @@ expect(item[:description]).to eq(value) end } end - -end \ No newline at end of file +end