Class: ODDB::FiParse::TestPatinfoHpricotCimifeminFr

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



424
425
426
427
428
429
430
431
# File 'ext/fiparse/test/test_patinfo_hpricot.rb', line 424

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

- (Object) test_amzv2



440
441
442
443
444
445
# File 'ext/fiparse/test/test_patinfo_hpricot.rb', line 440

def test_amzv2
  chapter = @writer.amzv
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('OEMéd', chapter.heading)
  assert_equal(0, chapter.sections.size)
end

- (Object) test_company2



435
436
437
438
439
# File 'ext/fiparse/test/test_patinfo_hpricot.rb', line 435

def test_company2
  chapter = @writer.company
  assert_instance_of(ODDB::Text::Chapter, chapter )
  assert_equal('ZELLER MEDICAL', chapter.heading)
end

- (Object) test_composition2



446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
# File 'ext/fiparse/test/test_patinfo_hpricot.rb', line 446

def test_composition2
  chapter = @writer.composition
  assert_instance_of(ODDB::Text::Chapter, chapter )
  assert_equal('Que contient Cimifemine?', chapter.heading)
  assert_equal(1, chapter.sections.size)
  section = chapter.sections.first
  assert_equal("", section.subheading)
  assert_equal(2, section.paragraphs.size)
  paragraph = section.paragraphs.at(0)
  expected =  "1 comprimé contient: 0,018–0,026 ml extrait liquide de rhizome "
  expected << "de Cimicifuga (actée à grappes), (RDE: 0,78–1,14:1), agent "
  expected << "d’extraction: isopropanol 40% (v/v)."
  assert_equal(expected, paragraph.text)
  paragraph = section.paragraphs.at(1)
  expected =  "Cette préparation contient en outre des excipients."
  assert_equal(expected, paragraph.text)
end

- (Object) test_name2



432
433
434
# File 'ext/fiparse/test/test_patinfo_hpricot.rb', line 432

def test_name2
  assert_equal('Cimifemine®', @writer.name)
end