Class: ODDB::OdbaExporter::TestCsvExporter

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'ext/export/test/test_csv_exporter.rb', line 18

def setup
  @addr = Address2.new
  @addr.address = "Foobodenstrasse 1"
  @addr.type = 'at_work'
  @addr.location = "1234 Neuchâtel"
  @addr.canton = 'NE'
  @addr.fon = ['fon1', 'fon2']
  @addr.fax = []
  @doc = Doctor.new
  @doc.title = "Dr. med" 
  @doc.exam="1998"
  @doc.addresses=[@addr]
  @doc.salutation="Herrn"
  @doc.name="Dami"
  @doc.="amig@amig.ch"
  @doc.ean13="7601000616715"
  @doc.language="franz\366sisch"
  @doc.firstname="Fabrice"
  @doc.praxis=false
  @doc.specialities = ['Kardiologie', 'Psychokardiologie']
  @group = Analysis::Group.new('8600')
  @pos = @group.create_position('00')
  @pos.anonymousgroup = '9300'
  @pos.anonymouspos = '00'
  @pos.finding = 'n'
  @pos.descriptions['de'] = 'Test de'
  @pos.descriptions['fr'] = 'Teste fr'
  footnote = @pos.create_footnote
  footnote.descriptions.store('de', "Fussnote")
  footnote.descriptions.store('fr', "FRussnote")
  taxnote = @pos.create_taxnote
  taxnote.descriptions.store('de','Taxen')
  taxnote.descriptions.store('fr','Taxes')
  list_title = @pos.create_list_title
  list_title.descriptions.store('de', 'Titel')
  list_title.descriptions.store('fr', 'Titre')
  limitation_text = @pos.create_limitation_text
  limitation_text.descriptions.store('de','Limit')
  limitation_text.descriptions.store('fr','LimitFR')
  permissions = @pos.create_permissions
  perm1 = Analysis::Permission.new('teiliste','spital')
  perm2 = Analysis::Permission.new('list1','blabla')
  perm3 = Analysis::Permission.new('list1','blabla')
  permissions.descriptions.store('de', [perm1, perm2])  
  permissions.descriptions.store('fr', [perm3])
  @pos.taxpoints = 30
  @pos.lab_areas = ['C','I']
end

- (Object) test_dump_1



66
67
68
69
70
71
# File 'ext/export/test/test_csv_exporter.rb', line 66

def test_dump_1
  expected = "7601000616715;1998;Herrn;Dr. med;Fabrice;Dami;false;at_work;\"\";\"\";Foobodenstrasse 1;1234;Neuch\342tel;NE;fon1,fon2;\"\";amig@amig.ch;franz\366sisch;Kardiologie,Psychokardiologie\n"
  fh = ''
  CsvExporter.dump(CsvExporter::DOCTOR, @doc, fh)
  assert_equal(expected, fh)
end

- (Object) test_dump_2



75
76
77
78
79
80
81
82
# File 'ext/export/test/test_csv_exporter.rb', line 75

def test_dump_2
  @addr.type = 'at_praxis'
  @doc.praxis = true
  expected = "7601000616715;1998;Herrn;Dr. med;Fabrice;Dami;true;at_praxis;\"\";\"\";Foobodenstrasse 1;1234;Neuch\342tel;NE;fon1,fon2;\"\";amig@amig.ch;franz\366sisch;Kardiologie,Psychokardiologie\n"
  fh = ''
  CsvExporter.dump(CsvExporter::DOCTOR, @doc, fh)
  assert_equal(expected, fh)
end

- (Object) test_dump_3



86
87
88
89
90
91
92
# File 'ext/export/test/test_csv_exporter.rb', line 86

def test_dump_3
  expected = "8600;00;9300.00;Test de;Teste fr;Fussnote;FRussnote;Taxen;Taxes;Limit;LimitFR;Titel;Titre;C,I;30;n;{teiliste}:{spital},{list1}:{blabla};{list1}:{blabla}\n"
  fh = ''
  CsvExporter.dump(CsvExporter::ANALYSIS, @pos, fh)
  #puts fh.inspect
  assert_equal(expected, fh)
end