oddb2xml 2.2.6 → 2.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/spec/calc_spec.rb CHANGED
@@ -523,7 +523,7 @@ Solvens: aqua ad iniectabilia q.s. ad suspensionem pro 1 ml."
523
523
  specify { expect(info.compositions.size).to eq 2 }
524
524
  specify { expect(info.compositions.first.label).to eq "Praeparatio cryodesiccata:" }
525
525
  substance1 = info.compositions.first.substances.find{ |x| x.name.match(/virus rabiei inactivatu/i) }
526
- specify { expect(substance1).should_not be nil }
526
+ specify { expect(expect(substance1)).not_to be nil }
527
527
  if substance1
528
528
  specify { expect(substance1.name).to eq 'Virus Rabiei Inactivatum (stamm: Wistar Rabies Pm/wi 38-1503-3m)' }
529
529
  end
@@ -650,7 +650,7 @@ describe Oddb2xml::Calc do
650
650
  expect(File.exists?(full)).to eq true
651
651
  }
652
652
  oddb_calc_xsd = File.expand_path(File.join(File.dirname(__FILE__), '..', 'oddb_calc.xsd'))
653
- File.exists?(oddb_calc_xsd).should eq true
653
+ expect(File.exists?(oddb_calc_xsd)).to eq true
654
654
  xsd = Nokogiri::XML::Schema(File.read(oddb_calc_xsd))
655
655
  doc = Nokogiri::XML(File.read(@oddb_calc_xml))
656
656
  xsd.validate(doc).each do |error| expect(error).to be_nil end
@@ -660,13 +660,13 @@ describe Oddb2xml::Calc do
660
660
  gtin = '7680540151009'
661
661
  ean12 = '7680' + sprintf('%05d',Tst_naropin.iksnr_A) + sprintf('%03d',Tst_naropin.pack_K)
662
662
  ean13 = (ean12 + Oddb2xml.calc_checksum(ean12))
663
- ean13.should eq gtin
663
+ expect(ean13).to eq gtin
664
664
 
665
665
  Tst_naropin.values_to_compare.each{
666
666
  | key, value |
667
667
  result = XPath.match( @doc, "//ARTICLE[GTIN='#{gtin}']/#{key.to_s.upcase}").first.text
668
668
  puts "Testing key #{key.inspect} #{value.inspect} against #{result} seems to fail" unless result == value.to_s
669
- result.should eq value.to_s
669
+ expect(result).to eq value.to_s
670
670
  }
671
671
  end
672
672
 
@@ -674,83 +674,83 @@ describe Oddb2xml::Calc do
674
674
  gtin = '7680560890018'
675
675
  ean12 = '7680' + sprintf('%05d',Tst_nutriflex.iksnr_A) + sprintf('%03d',Tst_nutriflex.pack_K)
676
676
  ean13 = (ean12 + Oddb2xml.calc_checksum(ean12))
677
- ean13.should eq gtin
677
+ expect(ean13).to eq gtin
678
678
  Tst_nutriflex.values_to_compare.each{
679
679
  | key, value |
680
680
  result = XPath.match( @doc, "//ARTICLE[GTIN='#{gtin}']/#{key.to_s.upcase}").first.text
681
681
  puts "Testing key #{key.inspect} #{value.inspect} against #{result} seems to fail" unless result == value.to_s
682
- result.should eq value.to_s
682
+ expect(result).to eq value.to_s
683
683
  }
684
684
  end
685
685
 
686
686
  it 'should create correct entries for 7680555940018' do
687
- XPath.match( @doc, "//ARTICLE[GTIN='7680555940018']/COMPOSITIONS/COMPOSITION/LABEL").first.text.should eq 'I'
688
- XPath.match( @doc, "//ARTICLE[GTIN='7680555940018']/COMPOSITIONS/COMPOSITION/LABEL_DESCRIPTION").first.text.should eq 'Glucoselösung'
687
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680555940018']/COMPOSITIONS/COMPOSITION/LABEL").first.text).to eq 'I'
688
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680555940018']/COMPOSITIONS/COMPOSITION/LABEL_DESCRIPTION").first.text).to eq 'Glucoselösung'
689
689
  XPath.match( @doc, "//ARTICLE[GTIN='7680555940018']/COMPOSITIONS/COMPOSITION/LABEL").each{ |x| puts x.text }
690
- XPath.match( @doc, "//ARTICLE[GTIN='7680555940018']/COMPOSITIONS/COMPOSITION/LABEL").last.text.should eq 'III'
691
- XPath.match( @doc, "//ARTICLE[GTIN='7680555940018']/COMPOSITIONS/COMPOSITION/CORRESP").last.text.should eq '4240 kJ pro 1 l'
690
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680555940018']/COMPOSITIONS/COMPOSITION/LABEL").last.text).to eq 'III'
691
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680555940018']/COMPOSITIONS/COMPOSITION/CORRESP").last.text).to eq '4240 kJ pro 1 l'
692
692
  end
693
693
 
694
694
  it 'should create correct entries for Lidocaini' do
695
- XPath.match( @doc, "//ARTICLE[GTIN='7680300150105']/COMPOSITIONS/COMPOSITION/SUBSTANCES/SUBSTANCE/SUBSTANCE_NAME").first.text.should eq 'Lidocaini Hydrochloridum'
696
- XPath.match( @doc, "//ARTICLE[GTIN='7680300150105']/COMPOSITIONS/COMPOSITION/SUBSTANCES/SUBSTANCE/UNIT").first.text.should eq 'mg/ml'
695
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680300150105']/COMPOSITIONS/COMPOSITION/SUBSTANCES/SUBSTANCE/SUBSTANCE_NAME").first.text).to eq 'Lidocaini Hydrochloridum'
696
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680300150105']/COMPOSITIONS/COMPOSITION/SUBSTANCES/SUBSTANCE/UNIT").first.text).to eq 'mg/ml'
697
697
  end
698
698
 
699
699
  it 'should create correct entries for Levomenolum' do
700
- XPath.match( @doc, "//ARTICLE[GTIN='7680434541015']/COMPOSITIONS/COMPOSITION/SUBSTANCES/SUBSTANCE/CHEMICAL_SUBSTANCE/SUBSTANCE_NAME").first.text.should eq 'Levomenolum'
701
- XPath.match( @doc, "//ARTICLE[GTIN='7680434541015']/COMPOSITIONS/COMPOSITION/SUBSTANCES/SUBSTANCE/CHEMICAL_SUBSTANCE/MORE_INFO").first.text.should eq 'ratio: 1:2-2.8'
702
- XPath.match( @doc, "//ARTICLE[GTIN='7680434541015']/COMPOSITIONS/COMPOSITION/SUBSTANCES/SUBSTANCE/CHEMICAL_SUBSTANCE/DOSE_TEXT").first.text.should eq '10-50 mg'
703
- XPath.match( @doc, "//ARTICLE[GTIN='7680434541015']/COMPOSITIONS/COMPOSITION/SUBSTANCES/SUBSTANCE/CHEMICAL_SUBSTANCE/QTY").first.should eq nil
704
- XPath.match( @doc, "//ARTICLE[GTIN='7680434541015']/COMPOSITIONS/COMPOSITION/SUBSTANCES/SUBSTANCE/CHEMICAL_SUBSTANCE/UNIT").first.should eq nil
700
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680434541015']/COMPOSITIONS/COMPOSITION/SUBSTANCES/SUBSTANCE/CHEMICAL_SUBSTANCE/SUBSTANCE_NAME").first.text).to eq 'Levomenolum'
701
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680434541015']/COMPOSITIONS/COMPOSITION/SUBSTANCES/SUBSTANCE/CHEMICAL_SUBSTANCE/MORE_INFO").first.text).to eq 'ratio: 1:2-2.8'
702
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680434541015']/COMPOSITIONS/COMPOSITION/SUBSTANCES/SUBSTANCE/CHEMICAL_SUBSTANCE/DOSE_TEXT").first.text).to eq '10-50 mg'
703
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680434541015']/COMPOSITIONS/COMPOSITION/SUBSTANCES/SUBSTANCE/CHEMICAL_SUBSTANCE/QTY").first).to eq nil
704
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680434541015']/COMPOSITIONS/COMPOSITION/SUBSTANCES/SUBSTANCE/CHEMICAL_SUBSTANCE/UNIT").first).to eq nil
705
705
  matri_name = 'Matricariae Extractum Isopropanolicum Liquidum'
706
- XPath.match( @doc, "//ARTICLE[GTIN='7680434541015']/COMPOSITIONS/COMPOSITION/SUBSTANCES/SUBSTANCE/SUBSTANCE_NAME").
707
- find{|x| x.text.eql?(matri_name)}.text.should eq matri_name
708
- XPath.match( @doc, "//ARTICLE[GTIN='7680434541015']/NAME").last.text.should eq 'Kamillin Medipharm, Bad'
709
- XPath.match( @doc, "//ARTICLE[GTIN='7680434541015']/GALENIC_FORM").last.text.should eq 'Bad'
710
- XPath.match( @doc, "//ARTICLE[GTIN='7680434541015']/COMPOSITIONS/COMPOSITION/SUBSTANCES/SUBSTANCE/QTY").first.text.should eq '98.9'
706
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680434541015']/COMPOSITIONS/COMPOSITION/SUBSTANCES/SUBSTANCE/SUBSTANCE_NAME").
707
+ find{|x| x.text.eql?(matri_name)}.text).to eq matri_name
708
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680434541015']/NAME").last.text).to eq 'Kamillin Medipharm, Bad'
709
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680434541015']/GALENIC_FORM").last.text).to eq 'Bad'
710
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680434541015']/COMPOSITIONS/COMPOSITION/SUBSTANCES/SUBSTANCE/QTY").first.text).to eq '98.9'
711
711
  end
712
712
 
713
713
  it 'should create correct entries for Magnesiumchlorid' do
714
- XPath.match( @doc, "//ARTICLE[GTIN='7680458820202']/NAME").last.text.should eq 'Magnesiumchlorid 0,5 molar B. Braun, Zusatzampulle für Infusionslösungen'
715
- XPath.match( @doc, "//ARTICLE[GTIN='7680458820202']/GALENIC_FORM").last.text.should match /Ampulle/i
714
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680458820202']/NAME").last.text).to eq 'Magnesiumchlorid 0,5 molar B. Braun, Zusatzampulle für Infusionslösungen'
715
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680458820202']/GALENIC_FORM").last.text).to match /Ampulle/i
716
716
  end
717
717
 
718
718
  it 'should create correct entries for W-Tropfen' do
719
- XPath.match( @doc, "//ARTICLE[GTIN='7680165980114']/COMPOSITIONS/COMPOSITION/EXCIPIENS/SUBSTANCE_NAME").first.text.should eq 'Excipiens ad solutionem'
720
- XPath.match( @doc, "//ARTICLE[GTIN='7680165980114']/COMPOSITIONS/COMPOSITION/EXCIPIENS/QTY").first.text.should eq '1'
721
- XPath.match( @doc, "//ARTICLE[GTIN='7680165980114']/COMPOSITIONS/COMPOSITION/EXCIPIENS/UNIT").first.text.should eq 'ml'
722
- XPath.match( @doc, "//ARTICLE[GTIN='7680165980114']/NAME").first.text.should eq 'W-Tropfen'
723
- XPath.match( @doc, "//ARTICLE[GTIN='7680165980114']/GALENIC_FORM").last.text.should eq 'Tropfen'
719
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680165980114']/COMPOSITIONS/COMPOSITION/EXCIPIENS/SUBSTANCE_NAME").first.text).to eq 'Excipiens ad solutionem'
720
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680165980114']/COMPOSITIONS/COMPOSITION/EXCIPIENS/QTY").first.text).to eq '1'
721
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680165980114']/COMPOSITIONS/COMPOSITION/EXCIPIENS/UNIT").first.text).to eq 'ml'
722
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680165980114']/NAME").first.text).to eq 'W-Tropfen'
723
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680165980114']/GALENIC_FORM").last.text).to eq 'Tropfen'
724
724
  end
725
725
 
726
726
  it 'should create correct entries for Coeur-Vaisseaux Sérocytol' do
727
- XPath.match( @doc, "//ARTICLE[GTIN='7680002770014']/NAME").first.text.should eq "Coeur-Vaisseaux Sérocytol, suppositoire"
727
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680002770014']/NAME").first.text).to eq "Coeur-Vaisseaux Sérocytol, suppositoire"
728
728
  end
729
729
 
730
730
  it 'should not have Alprostadilum' do
731
- XPath.match( @doc, "//ARTICLE[GTIN='7680545250363']").first.should eq nil
731
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680545250363']").first).to eq nil
732
732
  end
733
733
 
734
734
  it 'should create correct entries for Ceftriaxonum' do
735
- XPath.match( @doc, "//ARTICLE[GTIN='7680446250592']/COMPOSITIONS/COMPOSITION/SUBSTANCES/SUBSTANCE/SALTS/SALT/SUBSTANCE_NAME").first.text.should eq 'Ceftriaxonum Natricum'
735
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680446250592']/COMPOSITIONS/COMPOSITION/SUBSTANCES/SUBSTANCE/SALTS/SALT/SUBSTANCE_NAME").first.text).to eq 'Ceftriaxonum Natricum'
736
736
 
737
737
  end
738
738
 
739
739
  it 'should create correct entries for Nutriflex' do
740
- XPath.match( @doc, "//ARTICLE[GTIN='7680611860045']/NAME").first.text.should eq 'Nutriflex Omega special, Infusionsemulsion 2500 ml'
741
- XPath.match( @doc, "//ARTICLE[GTIN='7680611860045']/GALENIC_FORM").first.text.should eq 'Infusionsemulsion'
742
- XPath.match( @doc, "//ARTICLE[GTIN='7680611860045']/SELLING_UNITS").first.text.should eq '5'
740
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680611860045']/NAME").first.text).to eq 'Nutriflex Omega special, Infusionsemulsion 2500 ml'
741
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680611860045']/GALENIC_FORM").first.text).to eq 'Infusionsemulsion'
742
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680611860045']/SELLING_UNITS").first.text).to eq '5'
743
743
  end
744
744
 
745
745
  it 'should create correct entries for Apligraf' do
746
- XPath.match( @doc, "//ARTICLE[GTIN='7680589430011']/NAME").first.text.should eq 'Apligraf'
747
- XPath.match( @doc, "//ARTICLE[GTIN='7680589430011']/GALENIC_FORM").last.text.should eq 'Unbekannt' # TODO?? 'Scheibe(n)/disque(s)'
746
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680589430011']/NAME").first.text).to eq 'Apligraf'
747
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680589430011']/GALENIC_FORM").last.text).to eq 'Unbekannt' # TODO?? 'Scheibe(n)/disque(s)'
748
748
  end
749
749
 
750
750
  it 'should create correct entries for Caverject' do
751
- XPath.match( @doc, "//ARTICLE[GTIN='7680556740075']/NAME").first.text.should eq "Caverject DC 20, Injektionspräparat"
752
- XPath.match( @doc, "//ARTICLE[GTIN='7680556740075']/COMPOSITIONS/COMPOSITION/SUBSTANCES/SUBSTANCE").size.should eq 6
753
- XPath.match( @doc, "//ARTICLE[GTIN='7680556740075']/COMPOSITIONS/COMPOSITION/EXCIPIENS/SUBSTANCE_NAME").first.text.should eq "pro Vitro"
751
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680556740075']/NAME").first.text).to eq "Caverject DC 20, Injektionspräparat"
752
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680556740075']/COMPOSITIONS/COMPOSITION/SUBSTANCES/SUBSTANCE").size).to eq 6
753
+ expect(XPath.match( @doc, "//ARTICLE[GTIN='7680556740075']/COMPOSITIONS/COMPOSITION/EXCIPIENS/SUBSTANCE_NAME").first.text).to eq "pro Vitro"
754
754
  end
755
755
  end
756
756
  end
data/spec/cli_spec.rb CHANGED
@@ -15,16 +15,16 @@ RSpec::Matchers.define :have_option do |option|
15
15
  end
16
16
 
17
17
  shared_examples_for 'any interface for product' do
18
- it { @cli.should respond_to(:run) }
18
+ it { expect(@cli).to respond_to(:run) }
19
19
  it 'should run successfully' do
20
- @cli_output.should match(/products/)
20
+ expect(@cli_output).to match(/products/)
21
21
  end
22
22
  end
23
23
 
24
24
  shared_examples_for 'any interface for address' do
25
- it { buildr_capture(:stdout) { @cli.should respond_to(:run) } }
25
+ it { buildr_capture(:stdout) { expect(@cli).to respond_to(:run) } }
26
26
  it 'should run successfully' do
27
- @cli_output.should match(/addresses/)
27
+ expect(@cli_output).to match(/addresses/)
28
28
  end
29
29
  end
30
30
 
@@ -64,7 +64,7 @@ describe Oddb2xml::Cli do
64
64
  end
65
65
  # it_behaves_like 'any interface for product'
66
66
  it 'should have nonpharma option' do
67
- @cli.should have_option(:fi => true)
67
+ expect(@cli).to have_option(:fi => true)
68
68
  end
69
69
  end
70
70
 
@@ -78,11 +78,11 @@ describe Oddb2xml::Cli do
78
78
  end
79
79
  it_behaves_like 'any interface for product'
80
80
  it 'should have tag_suffix option' do
81
- @cli.should have_option(:tag_suffix=> 'MD')
81
+ expect(@cli).to have_option(:tag_suffix=> 'MD')
82
82
  end
83
83
  it 'should not create a compressed file' do
84
- Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.tar.gz')).first.should be_nil
85
- Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.zip')).first.should be_nil
84
+ expect(Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.tar.gz')).first).to be_nil
85
+ expect(Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.zip')).first).to be_nil
86
86
  end
87
87
  it 'should create xml files with prefix swiss_' do
88
88
  expected = [
@@ -105,7 +105,7 @@ describe Oddb2xml::Cli do
105
105
  }
106
106
  end
107
107
  it 'should produce a correct report' do
108
- @cli_output.should match(/Pharma products:/)
108
+ expect(@cli_output).to match(/Pharma products:/)
109
109
  end
110
110
  end
111
111
 
@@ -121,21 +121,21 @@ describe Oddb2xml::Cli do
121
121
 
122
122
  it_behaves_like 'any interface for product'
123
123
  it 'should not create any xml file' do
124
- @cli_output.should match(/Pharma/)
124
+ expect(@cli_output).to match(/Pharma/)
125
125
  Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.xml')).each do |file|
126
- File.exists?(file).should be_false
126
+ expect(File.exists?(file)).to be_falsey
127
127
  end
128
128
  end
129
129
  it 'should have compress option' do
130
- @cli.should have_option(:compress_ext => 'tar.gz')
130
+ expect(@cli).to have_option(:compress_ext => 'tar.gz')
131
131
  end
132
132
  it 'should create tar.gz file' do
133
133
  file = Dir.glob(File.join(Dir.pwd, 'oddb_*.tar.gz')).first
134
- File.exists?(file).should eq true
134
+ expect(File.exists?(file)).to eq true
135
135
  end
136
136
  it 'should not create any xml file' do
137
137
  Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.xml')).each do |file|
138
- File.exists?(file).should be_false
138
+ expect(File.exists?(file)).to be_falsey
139
139
  end
140
140
  end
141
141
  end
@@ -150,18 +150,18 @@ describe Oddb2xml::Cli do
150
150
  end
151
151
  it_behaves_like 'any interface for product'
152
152
  it 'should have compress option' do
153
- @cli.should have_option(:compress_ext => 'zip')
153
+ expect(@cli).to have_option(:compress_ext => 'zip')
154
154
  end
155
155
  it 'should create zip file' do
156
- @cli_output.should match(/Pharma/)
156
+ expect(@cli_output).to match(/Pharma/)
157
157
  file = Dir.glob(File.join(Dir.pwd, 'oddb_*.zip')).first
158
- File.exists?(file).should eq true
158
+ expect(File.exists?(file)).to eq true
159
159
  end
160
160
  it 'should not create any xml file' do
161
161
  Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.xml')).each do |file| FileUtil.rm_f(file) end
162
- @cli_output.should match(/Pharma/)
162
+ expect(@cli_output).to match(/Pharma/)
163
163
  Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.xml')).each do |file|
164
- File.exists?(file).should be_false
164
+ expect(File.exists?(file)).to be_falsey
165
165
  end
166
166
  end
167
167
  end
@@ -176,16 +176,16 @@ describe Oddb2xml::Cli do
176
176
  end
177
177
  it_behaves_like 'any interface for product'
178
178
  it 'should have nonpharma option' do
179
- @cli.should have_option(:format => :dat, :extended => false)
179
+ expect(@cli).to have_option(:format => :dat, :extended => false)
180
180
  end
181
181
  it 'should create the needed files' do
182
- @cli_output.should match(/\sPharma\s/)
182
+ expect(@cli_output).to match(/\sPharma\s/)
183
183
  expected = [
184
184
  'duplicate_ean13_from_zur_rose.txt',
185
185
  'zurrose_transfer.dat',
186
186
  'oddb.dat',
187
187
  ].each{ |file|
188
- File.exists?(File.join(Oddb2xml::WorkDir, file)).should eq true
188
+ expect(File.exists?(File.join(Oddb2xml::WorkDir, file))).to eq true
189
189
  }
190
190
  end
191
191
  end
@@ -200,15 +200,15 @@ describe Oddb2xml::Cli do
200
200
  end
201
201
  it_behaves_like 'any interface for product'
202
202
  it 'should have nonpharma option' do
203
- @cli.should have_option(:nonpharma => true)
203
+ expect(@cli).to have_option(:nonpharma => true)
204
204
  end
205
205
  it 'should not create any compressed file' do
206
- @cli_output.should match(/NonPharma/)
207
- Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.tar.gz')).first.should be_nil
208
- Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.zip')).first.should be_nil
206
+ expect(@cli_output).to match(/NonPharma/)
207
+ expect(Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.tar.gz')).first).to be_nil
208
+ expect(Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.zip')).first).to be_nil
209
209
  end
210
210
  it 'should create xml files' do
211
- @cli_output.should match(/NonPharma/)
211
+ expect(@cli_output).to match(/NonPharma/)
212
212
  expected = [
213
213
  'oddb_product.xml',
214
214
  'oddb_article.xml',
@@ -217,9 +217,9 @@ describe Oddb2xml::Cli do
217
217
  'oddb_interaction.xml',
218
218
  'oddb_code.xml'
219
219
  ].length
220
- Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.xml')).each do |file|
221
- File.exists?(file).should eq true
222
- end.to_a.length.should equal expected
220
+ expect(Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.xml')).each do |file|
221
+ expect(File.exists?(file)).to eq true
222
+ end.to_a.length).to equal expected
223
223
  end
224
224
  end
225
225
  context 'when -t _swiss option is given' do
@@ -232,15 +232,15 @@ describe Oddb2xml::Cli do
232
232
  end
233
233
  it_behaves_like 'any interface for product'
234
234
  it 'should have tag_suffix option' do
235
- @cli.should have_option(:tag_suffix=> '_SWISS')
235
+ expect(@cli).to have_option(:tag_suffix=> '_SWISS')
236
236
  end
237
237
  it 'should not create any compressed file' do
238
- @cli_output.should match(/Pharma/)
239
- Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.tar.gz')).first.should be_nil
240
- Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.zip')).first.should be_nil
238
+ expect(@cli_output).to match(/Pharma/)
239
+ expect(Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.tar.gz')).first).to be_nil
240
+ expect(Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.zip')).first).to be_nil
241
241
  end
242
242
  it 'should create xml files with prefix swiss_' do
243
- @cli_output.should match(/Pharma/)
243
+ expect(@cli_output).to match(/Pharma/)
244
244
  expected = [
245
245
  'swiss_product.xml',
246
246
  'swiss_article.xml',
@@ -249,9 +249,9 @@ describe Oddb2xml::Cli do
249
249
  'swiss_interaction.xml',
250
250
  'swiss_code.xml'
251
251
  ].length
252
- Dir.glob(File.join(Oddb2xml::WorkDir, 'swiss_*.xml')).each do |file|
253
- File.exists?(file).should eq true
254
- end.to_a.length.should equal expected
252
+ expect(Dir.glob(File.join(Oddb2xml::WorkDir, 'swiss_*.xml')).each do |file|
253
+ expect(File.exists?(file)).to eq true
254
+ end.to_a.length).to equal expected
255
255
  end
256
256
  end
257
257
  context 'when -o fi option is given' do
@@ -264,15 +264,15 @@ describe Oddb2xml::Cli do
264
264
  end
265
265
  it_behaves_like 'any interface for product'
266
266
  it 'should have nonpharma option' do
267
- @cli.should have_option(:fi => true)
267
+ expect(@cli).to have_option(:fi => true)
268
268
  end
269
269
  it 'should not create any compressed file' do
270
- @cli_output.should match(/Pharma/)
271
- Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.tar.gz')).first.should be_nil
272
- Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.zip')).first.should be_nil
270
+ expect(@cli_output).to match(/Pharma/)
271
+ expect(Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.tar.gz')).first).to be_nil
272
+ expect(Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.zip')).first).to be_nil
273
273
  end
274
274
  it 'should create xml files' do
275
- @cli_output.should match(/Pharma/)
275
+ expect(@cli_output).to match(/Pharma/)
276
276
  expected = [
277
277
  'oddb_fi.xml',
278
278
  'oddb_fi_product.xml',
@@ -283,9 +283,9 @@ describe Oddb2xml::Cli do
283
283
  'oddb_interaction.xml',
284
284
  'oddb_code.xml'
285
285
  ].length
286
- Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.xml')).each do |file|
287
- File.exists?(file).should eq true
288
- end.to_a.length.should equal expected
286
+ expect(Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.xml')).each do |file|
287
+ expect(File.exists?(file)).to eq true
288
+ end.to_a.length).to equal expected
289
289
  end
290
290
  end
291
291
  context 'when -x address option is given' do
@@ -298,22 +298,24 @@ describe Oddb2xml::Cli do
298
298
  end
299
299
  it_behaves_like 'any interface for address'
300
300
  it 'should have address option' do
301
- @cli.should have_option(:address=> true)
301
+ expect(@cli).to have_option(:address=> true)
302
302
  end
303
303
  it 'should not create any compressed file' do
304
- @cli_output.should match(/addresses/)
305
- Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.tar.gz')).first.should be_nil
306
- Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.zip')).first.should be_nil
304
+ pending 'Cannot download medreg at the moment'
305
+ expect(@cli_output).to match(/addresses/)
306
+ expect(Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.tar.gz')).first).to be_nil
307
+ expect(Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.zip')).first).to be_nil
307
308
  end
308
309
  it 'should create xml files' do
309
- @cli_output.should match(/addresses/)
310
+ pending 'Cannot download medreg at the moment'
311
+ expect(@cli_output).to match(/addresses/)
310
312
  expected = [
311
313
  'oddb_betrieb.xml',
312
314
  'oddb_medizinalperson.xml',
313
315
  ].length
314
- Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.xml')).each do |file|
315
- File.exists?(file).should eq true
316
- end.to_a.length.should equal expected
316
+ expect(Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.xml')).each do |file|
317
+ expect(File.exists?(file)).to eq true
318
+ end.to_a.length).to equal expected
317
319
  end
318
- end
320
+ end if false # TODO: pending medreg
319
321
  end
@@ -4,17 +4,17 @@ require 'spec_helper'
4
4
 
5
5
  shared_examples_for 'any compressor' do
6
6
  it 'should create compress file' do
7
- File.stub(:unlink).and_return(false)
7
+ allow(File).to receive(:unlink).and_return(false)
8
8
  @compressor.contents << File.join(Oddb2xml::SpecCompressor, 'oddb_article.xml')
9
9
  @compressor.contents << File.join(Oddb2xml::SpecCompressor, 'oddb_product.xml')
10
10
  @compressor.contents << File.join(Oddb2xml::SpecCompressor, 'oddb_substance.xml')
11
11
  @compressor.contents << File.join(Oddb2xml::SpecCompressor, 'oddb_limitation.xml')
12
12
  @compressor.contents << File.join(Oddb2xml::SpecCompressor, 'oddb_fi.xml')
13
13
  @compressor.contents << File.join(Oddb2xml::SpecCompressor, 'oddb_fi_product.xml')
14
- @compressor.finalize!.should eq(true)
14
+ expect(@compressor.finalize!).to eq(true)
15
15
  compress_file = @compressor.instance_variable_get(:@compress_file)
16
- File.exists?(compress_file).should == true
17
- File.unstub(:unlink)
16
+ expect(File.exists?(compress_file)).to eq(true)
17
+ allow(File).to receive(:unlink).and_call_original
18
18
  @compressor = nil
19
19
  end
20
20
  end
@@ -37,12 +37,12 @@ describe Oddb2xml::Compressor do
37
37
  @compressor = Oddb2xml::Compressor.new
38
38
  end
39
39
  it 'should have empty contents as array' do
40
- @compressor.contents.should be_a Array
41
- @compressor.contents.should be_empty
40
+ expect(@compressor.contents).to be_a Array
41
+ expect(@compressor.contents).to be_empty
42
42
  end
43
43
  it 'should have formated filename with datetime' do
44
- @compressor.instance_variable_get(:@compress_file).
45
- should =~ /oddb_xml_\d{2}.\d{2}.\d{4}_\d{2}.\d{2}.tar\.gz/
44
+ expect(@compressor.instance_variable_get(:@compress_file)).
45
+ to match(/oddb_xml_\d{2}.\d{2}.\d{4}_\d{2}.\d{2}.tar\.gz/)
46
46
  end
47
47
  end
48
48
  context "when swiss prefix is given" do
@@ -51,8 +51,8 @@ describe Oddb2xml::Compressor do
51
51
  @compressor = Oddb2xml::Compressor.new('swiss', {:compress_ext => 'tar.gz'})
52
52
  end
53
53
  it 'should have formated filename with datetime' do
54
- @compressor.instance_variable_get(:@compress_file).
55
- should =~ /swiss_xml_\d{2}.\d{2}.\d{4}_\d{2}.\d{2}.tar\.gz/
54
+ expect(@compressor.instance_variable_get(:@compress_file)).
55
+ to match(/swiss_xml_\d{2}.\d{2}.\d{4}_\d{2}.\d{2}.tar\.gz/)
56
56
  end
57
57
  end
58
58
  context "when tar.gz ext is given" do
@@ -61,8 +61,8 @@ describe Oddb2xml::Compressor do
61
61
  @compressor = Oddb2xml::Compressor.new('oddb', {:compress_ext => 'tar.gz'})
62
62
  end
63
63
  it 'should have formated filename with datetime' do
64
- @compressor.instance_variable_get(:@compress_file).
65
- should =~ /oddb_xml_\d{2}.\d{2}.\d{4}_\d{2}.\d{2}.tar\.gz/
64
+ expect(@compressor.instance_variable_get(:@compress_file)).
65
+ to match(/oddb_xml_\d{2}.\d{2}.\d{4}_\d{2}.\d{2}.tar\.gz/)
66
66
  end
67
67
  end
68
68
  context "when zip ext is given" do
@@ -71,8 +71,8 @@ describe Oddb2xml::Compressor do
71
71
  @compressor = Oddb2xml::Compressor.new('oddb', {:compress_ext => 'zip'})
72
72
  end
73
73
  it 'should have formated filename with datetime' do
74
- @compressor.instance_variable_get(:@compress_file).
75
- should =~ /oddb_xml_\d{2}.\d{2}.\d{4}_\d{2}.\d{2}.zip/
74
+ expect(@compressor.instance_variable_get(:@compress_file)).
75
+ to match(/oddb_xml_\d{2}.\d{2}.\d{4}_\d{2}.\d{2}.zip/)
76
76
  end
77
77
  end
78
78
  end
@@ -88,11 +88,11 @@ describe Oddb2xml::Compressor do
88
88
  Dir.chdir @savedDir if @savedDir and File.directory?(@savedDir)
89
89
  end
90
90
  it 'should fail with no contents' do
91
- @compressor.finalize!.should == false
91
+ expect(@compressor.finalize!).to eq(false)
92
92
  end
93
93
  it 'should fail with invalid file' do
94
94
  @compressor.contents << '../invalid_file'
95
- @compressor.finalize!.should == false
95
+ expect(@compressor.finalize!).to eq(false)
96
96
  end
97
97
  end
98
98
  context 'successfully' do
Binary file
Binary file
Binary file