Class: ODDB::TestAddress

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
test/test_model/address.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



12
13
14
# File 'test/test_model/address.rb', line 12

def setup
  @address = ODDB::Address.new
end

- (Object) test_plz_city



111
112
113
114
115
116
117
118
119
120
121
# File 'test/test_model/address.rb', line 111

def test_plz_city
  @address.lines = [
    'Herrn Dr. med.',
    'Bernhard Hugentobler',
    'Arztpraxis',
    'Muhlernstr. 244A',
    '3098 Schliern b. Koenitz',
  ]
  assert_equal('Schliern b. Koenitz', @address.city)
  assert_equal('3098', @address.plz)
end

- (Object) test_plz_city_lines_hack



122
123
124
125
126
127
128
129
130
131
132
133
# File 'test/test_model/address.rb', line 122

def test_plz_city_lines_hack
  @address.lines = [
    'Herrn Dr. med.',
    'Bernhard Hugentobler',
    'Arztpraxis',
    'Muhlernstr. 244A',
    '3098 Schliern b. Koenitz',
    '',
  ]
  assert_equal('Schliern b. Koenitz', @address.city)
  assert_equal('3098', @address.plz)
end

- (Object) test_search_terms



134
135
136
137
# File 'test/test_model/address.rb', line 134

def test_search_terms
  expected = []
  assert_equal expected, @address.search_terms
end

- (Object) test_search_terms__dr



34
35
36
37
38
39
40
41
42
43
44
45
# File 'test/test_model/address.rb', line 34

def test_search_terms__dr
  @address.lines = [
    'Herr Dr. med.',
    'Herrn Dr. med.',
    'Frau Dr. med',
    '6500 Bellinzona' 
  ]
  expected = [
    '6500 Bellinzona' 
  ]
  assert_equal(expected, @address.lines_without_title)
end

- (Object) test_search_terms__prof



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'test/test_model/address.rb', line 15

def test_search_terms__prof
  @address.lines = [
    'Egregio Prof.',
    'Monsieur le Professeur',
    'Claudio Marone',
    'Studio medico',
    'Christoph Profos',
    'Ospedale San Giovanni',
    '6500 Bellinzona' 
  ]
  expected = [
    'Claudio Marone',
    'Studio medico',
    'Christoph Profos',
    'Ospedale San Giovanni',
    '6500 Bellinzona' 
  ]
  assert_equal(expected, @address.lines_without_title)
end

- (Object) test_street__1



46
47
48
49
50
51
52
53
54
55
56
# File 'test/test_model/address.rb', line 46

def test_street__1
  @address.lines = [
    'Herrn Dr. med.',
    'Rolf Hugentobler',
    'Arztpraxis',
    'Stichweg 8',
    '5024 Kuettigen',
  ]
  assert_equal('Stichweg', @address.street)
  assert_equal('8', @address.number)
end

- (Object) test_street__2



57
58
59
60
61
62
63
64
# File 'test/test_model/address.rb', line 57

def test_street__2
  @address.lines = [
    'Ospedale San Giovanni',
    '6500 Bellinzona' 
  ]
  assert_equal('Ospedale San Giovanni', @address.street)
  assert_nil(@address.number)
end

- (Object) test_street__3



65
66
67
68
69
70
71
72
73
74
75
76
# File 'test/test_model/address.rb', line 65

def test_street__3
  @address.lines = [
    'Herrn Dr. med.',
    'Johannes Andreas Blum',
    'Arztpraxis',
    'Schweiz. Tropeninstitut Basel',
    'Socinstr. 57, Postfach',
    '4002 Basel',
  ]
  assert_equal('Socinstr.', @address.street)
  assert_equal('57', @address.number)
end

- (Object) test_street__4



77
78
79
80
81
82
83
84
85
86
87
# File 'test/test_model/address.rb', line 77

def test_street__4
  @address.lines = [
    'Madame le Docteur',
    'Verena Schweizer-Rohrer',
    'Cabinet medical',
    '4, rte d\'Arnier',
    '1092 Belmont-Lausanne',
  ]
  assert_equal('rte d\'Arnier', @address.street)
  assert_equal('4', @address.number)
end

- (Object) test_street__5



88
89
90
91
92
93
94
95
96
97
98
# File 'test/test_model/address.rb', line 88

def test_street__5
  @address.lines = [
    'Herrn Dr. med.',
    'Bernhard Hugentobler',
    'Arztpraxis',
    'Muhlernstr. 244A',
    '3098 Schliern b. Koenitz',
  ]
  assert_equal('Muhlernstr.', @address.street)
  assert_equal('244A', @address.number)
end

- (Object) test_street__5_lines_hack



99
100
101
102
103
104
105
106
107
108
109
110
# File 'test/test_model/address.rb', line 99

def test_street__5_lines_hack
  @address.lines = [
    'Herrn Dr. med.',
    'Bernhard Hugentobler',
    'Arztpraxis',
    'Muhlernstr. 244A',
    '3098 Schliern b. Koenitz',
    '',
  ]
  assert_equal('Muhlernstr.', @address.street)
  assert_equal('244A', @address.number)
end