Class: ODDB::FiParse::TestPatinfoHpricotNasivinDe

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
ext/fiparse/test/test_patinfo_hpricot.rb

Instance Method Summary collapse

Instance Method Details

#setupObject



545
546
547
548
549
550
551
552
# File 'ext/fiparse/test/test_patinfo_hpricot.rb', line 545

def setup
  @path = File.expand_path('data/html/de/nasivin.html', 
    File.dirname(__FILE__))
  @writer = PatinfoHpricot.new
  open(@path) { |fh| 
    @patinfo = @writer.extract(Hpricot(fh))
  }
end

#test_composition5Object



553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
# File 'ext/fiparse/test/test_patinfo_hpricot.rb', line 553

def test_composition5
  chapter = @writer.effects
  assert_instance_of(ODDB::Text::Chapter, chapter )
  assert_equal('Was ist Nasivin und wann wird es angewendet?', chapter.heading)
  section = chapter.sections.first
  assert_instance_of(ODDB::Text::Section, section )
  assert_equal('', section.subheading)
  chapter = @writer.composition
  assert_instance_of(ODDB::Text::Chapter, chapter )
  assert_equal('Was ist in Nasivin enthalten?', chapter.heading)
  chapter = @writer.packages
  assert_instance_of(ODDB::Text::Chapter, chapter )
  assert_equal('Wo erhalten Sie Nasivin? Welche Packungen sind erhältlich?', chapter.heading)
  section = chapter.sections.first
  paragraph = section.paragraphs.first
  assert_instance_of(ODDB::Text::Paragraph, paragraph )
  assert_equal("In Apotheken und Drogerien ohne ärztliche Verschreibung.", 
               paragraph.text)
  chapter = @writer.date
  assert_instance_of(ODDB::Text::Chapter, chapter )
  assert_equal('', chapter.heading)
  section = chapter.sections.first
  assert_instance_of(ODDB::Text::Section, section )
  assert_equal("", section.subheading)
  assert_equal(1, section.paragraphs.size)
  assert_equal("Diese Packungsbeilage wurde im März 2007 letztmals durch die Arzneimittelbehörde (Swissmedic) geprüft.", section.to_s)
   

end