Class: ODDB::FiParse::TestPatinfoHpricotCimifeminFr
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- ODDB::FiParse::TestPatinfoHpricotCimifeminFr
- Defined in:
- ext/fiparse/test/test_patinfo_hpricot.rb
Instance Method Summary collapse
- #setup ⇒ Object
- #test_amzv2 ⇒ Object
- #test_company2 ⇒ Object
- #test_composition2 ⇒ Object
- #test_name2 ⇒ Object
Instance Method Details
#setup ⇒ Object
421 422 423 424 425 426 427 428 |
# File 'ext/fiparse/test/test_patinfo_hpricot.rb', line 421 def setup @path = File.('data/html/fr/cimifemin.html', File.dirname(__FILE__)) @writer = PatinfoHpricot.new open(@path) { |fh| @writer.extract(Hpricot(fh)) } end |
#test_amzv2 ⇒ Object
437 438 439 440 441 442 |
# File 'ext/fiparse/test/test_patinfo_hpricot.rb', line 437 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 |
#test_company2 ⇒ Object
432 433 434 435 436 |
# File 'ext/fiparse/test/test_patinfo_hpricot.rb', line 432 def test_company2 chapter = @writer.company assert_instance_of(ODDB::Text::Chapter, chapter ) assert_equal('ZELLER MEDICAL', chapter.heading) end |
#test_composition2 ⇒ Object
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 |
# File 'ext/fiparse/test/test_patinfo_hpricot.rb', line 443 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 |
#test_name2 ⇒ Object
429 430 431 |
# File 'ext/fiparse/test/test_patinfo_hpricot.rb', line 429 def test_name2 assert_equal('Cimifemine®', @writer.name) end |