Class: ODDB::FiParse::TestPatinfoHpricotPonstanDe

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

Instance Method Summary collapse

Instance Method Details

#setupObject



505
506
507
508
509
510
511
512
# File 'ext/fiparse/test/test_patinfo_hpricot.rb', line 505

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

#test_composition4Object



513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
# File 'ext/fiparse/test/test_patinfo_hpricot.rb', line 513

def test_composition4
  chapter = @writer.composition
  assert_instance_of(ODDB::Text::Chapter, chapter )
  assert_equal('Was ist in Ponstan enthalten?', chapter.heading)
  assert_equal(5, chapter.sections.size)
  section = chapter.sections.at(0)
  assert_equal("", section.subheading)
  assert_equal(1, section.paragraphs.size)
  paragraph = section.paragraphs.at(0)
  expected =  "Wirkstoff: Mefenaminsäure."
  assert_equal(expected, paragraph.text)
  section = chapter.sections.at(1)
  assert_equal("Filmtabletten\n", section.subheading)
  assert_equal(1, section.paragraphs.size)
  paragraph = section.paragraphs.at(0)
  expected =  "500 mg Mefenaminsäure sowie Vanillin (Aromaticum) und andere "
  expected << "Hilfsstoffe."
  assert_equal(expected, paragraph.text)
  section = chapter.sections.last
  assert_equal("Suspension\n", section.subheading)
  assert_equal(2, section.paragraphs.size)
  paragraph = section.paragraphs.at(0)
  expected =  "5 ml enthalten 50 mg Mefenaminsäure, Konservierungsmittel: "
  expected << "Natriumbenzoat (E 211), Saccharin, Vanillin, Aromatica und "
  expected << "andere Hilfsstoffe."
  assert_equal(expected, paragraph.text)
  paragraph = section.paragraphs.at(1)
  expected =  "5 ml enthalten 1 g Zucker (0,1 Brotwert)."
  assert_equal(expected, paragraph.text)
end