Class: ODDB::FiParse::TestFachinfoHpricotAlcaCDe
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- ODDB::FiParse::TestFachinfoHpricotAlcaCDe
- Defined in:
- ext/fiparse/test/test_fachinfo_hpricot.rb
Instance Method Summary collapse
- #setup ⇒ Object
- #test_amzv1 ⇒ Object
- #test_company1 ⇒ Object
- #test_composition1 ⇒ Object
- #test_date1 ⇒ Object
- #test_effects1 ⇒ Object
- #test_fachinfo1 ⇒ Object
- #test_galenic_form1 ⇒ Object
- #test_iksnrs1 ⇒ Object
- #test_indications1 ⇒ Object
- #test_interactions1 ⇒ Object
- #test_kinetic1 ⇒ Object
- #test_name1 ⇒ Object
- #test_other_advice1 ⇒ Object
- #test_overdose1 ⇒ Object
- #test_restrictions1 ⇒ Object
- #test_unwanted_effects1 ⇒ Object
- #test_usage1 ⇒ Object
Instance Method Details
#setup ⇒ Object
71 72 73 74 75 76 77 78 |
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 71 def setup @path = File.('data/html/de/alcac.fi.html', File.dirname(__FILE__)) @writer = FachinfoHpricot.new open(@path) { |fh| @fachinfo = @writer.extract(Hpricot(fh)) } end |
#test_amzv1 ⇒ Object
97 98 99 |
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 97 def test_amzv1 assert_nil @writer.amzv end |
#test_company1 ⇒ Object
85 86 87 88 89 90 |
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 85 def test_company1 ## this is unused. Since it's part of the base-class TextinfoHpricot, let's test it. chapter = @writer.company assert_instance_of(ODDB::Text::Chapter, chapter ) assert_equal('NOVARTIS CONSUMER HEALTH', chapter.heading) end |
#test_composition1 ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 100 def test_composition1 chapter = @fachinfo.composition assert_instance_of(ODDB::Text::Chapter, chapter ) assert_equal('Zusammensetzung', chapter.heading) assert_equal(1, chapter.sections.size) section = chapter.sections.first assert_equal("", section.subheading) assert_equal(3, section.paragraphs.size) paragraph = section.paragraphs.at(0) expected = "Wirkstoffe:" assert_equal(expected, paragraph.text) paragraph = section.paragraphs.at(1) expected = /1 Brausetablette enth.*lt: Carbasalatum calcicum 528.*mg corresp. Acidum Acetylsalicylicum 415.*mg, Acidum ascorbicum 250.*mg./ assert_match(expected, paragraph.text) paragraph = section.paragraphs.at(2) expected = /Hilfsstoffe: Saccharinum, Cyclamas, Aromatica, Color.: E.*120\./ assert_match(expected, paragraph.text) end |
#test_date1 ⇒ Object
168 169 170 171 172 |
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 168 def test_date1 chapter = @fachinfo.date assert_instance_of(ODDB::Text::Chapter, chapter) assert_equal('Stand der Information', chapter.heading) end |
#test_effects1 ⇒ Object
118 119 120 121 122 |
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 118 def test_effects1 chapter = @fachinfo.effects assert_instance_of(ODDB::Text::Chapter, chapter ) assert_equal('Eigenschaften/Wirkungen', chapter.heading) end |
#test_fachinfo1 ⇒ Object
79 80 81 |
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 79 def test_fachinfo1 assert_instance_of(FachinfoDocument, @fachinfo) end |
#test_galenic_form1 ⇒ Object
91 92 93 94 95 96 |
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 91 def test_galenic_form1 chapter = @fachinfo.galenic_form assert_instance_of(ODDB::Text::Chapter, chapter) assert_equal('Antipyretikum/Analgetikum mit Vitamin C', chapter.heading) assert_equal(0, chapter.sections.size) end |
#test_iksnrs1 ⇒ Object
163 164 165 166 167 |
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 163 def test_iksnrs1 chapter = @fachinfo.iksnrs assert_instance_of(ODDB::Text::Chapter, chapter) assert_equal('IKS-Nummern', chapter.heading) end |
#test_indications1 ⇒ Object
128 129 130 131 132 |
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 128 def test_indications1 chapter = @fachinfo.indications assert_instance_of(ODDB::Text::Chapter, chapter) assert_equal('Indikationen/Anwendungsmöglichkeiten', chapter.heading) end |
#test_interactions1 ⇒ Object
148 149 150 151 152 |
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 148 def test_interactions1 chapter = @fachinfo.interactions assert_instance_of(ODDB::Text::Chapter, chapter) assert_equal('Interaktionen', chapter.heading) end |
#test_kinetic1 ⇒ Object
123 124 125 126 127 |
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 123 def test_kinetic1 chapter = @fachinfo.kinetic assert_instance_of(ODDB::Text::Chapter, chapter) assert_equal('Pharmakokinetik', chapter.heading) end |
#test_name1 ⇒ Object
82 83 84 |
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 82 def test_name1 assert_equal('Alca-C®', @fachinfo.name) end |
#test_other_advice1 ⇒ Object
158 159 160 161 162 |
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 158 def test_other_advice1 chapter = @fachinfo.other_advice assert_instance_of(ODDB::Text::Chapter, chapter) assert_equal('Sonstige Hinweise', chapter.heading) end |
#test_overdose1 ⇒ Object
153 154 155 156 157 |
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 153 def test_overdose1 chapter = @fachinfo.overdose assert_instance_of(ODDB::Text::Chapter, chapter) assert_equal('Überdosierung', chapter.heading) end |
#test_restrictions1 ⇒ Object
138 139 140 141 142 |
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 138 def test_restrictions1 chapter = @fachinfo.restrictions assert_instance_of(ODDB::Text::Chapter, chapter) assert_equal('Anwendungseinschränkungen', chapter.heading) end |