Class: ODDB::TestAddress2

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



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

def setup
  @address = Address2.new
end

- (Object) test_compare



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'test/test_model/address2.rb', line 170

def test_compare
  @address.title = 'Herrn Dr. med.'
  @address.name = 'Werner Blaumacher'
  @address.additional_lines = [ 'Arztpraxis', 
    'Praxisgemeinschaft Steinfels' ]
  @address.address = 'Burweg 28'
  @address.location = '8706 Meilen'
  other = Address2.new
  other.title = 'Frau Dr. med.'
  other.name = 'Waltraud Hotzenköcherle'
  other.additional_lines = [ 'Arztpraxis', 
    'Praxisgemeinschaft Steinfels' ]
  other.address = 'Burgweg 28'
  other.location = '8706 Meilen'
  assert_equal([other, @address], [@address, other].sort)
end

- (Object) test_lines__1



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'test/test_model/address2.rb', line 73

def test_lines__1
  @address.title = 'Herrn Dr. med.'
  @address.name = 'Werner Blaumacher'
  @address.additional_lines = ['Arztpraxis', 
  'Praxisgemeinschaft Steinfels']
  @address.address = 'Burgweg 28'
  @address.location = '8706 Meilen'

  expected = [
    'Herrn Dr. med.',
    'Werner Blaumacher',
    'Arztpraxis',
    'Praxisgemeinschaft Steinfels',
    'Burgweg 28',
    '8706 Meilen',
  ]
  assert_equal(expected, @address.lines)
end

- (Object) test_lines__2



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'test/test_model/address2.rb', line 91

def test_lines__2
  @address.title = 'Herrn Dr. med.'
  @address.name = 'Werner Blaumacher'
  @address.additional_lines = ['Arztpraxis']
  @address.address = 'Burgweg 28'
  @address.location = '8706 Meilen'

  expected = [
    'Herrn Dr. med.',
    'Werner Blaumacher',
    'Arztpraxis',
    'Burgweg 28',
    '8706 Meilen',
  ]
  assert_equal(expected, @address.lines)
end

- (Object) test_location__1



48
49
50
51
52
# File 'test/test_model/address2.rb', line 48

def test_location__1
  @address.location = '8000 Zürich'
  assert_equal('8000', @address.plz)
  assert_equal('Zürich', @address.city)
end

- (Object) test_location__2



53
54
55
56
57
# File 'test/test_model/address2.rb', line 53

def test_location__2
  @address.location = 'Zürich'
  assert_equal('Zürich', @address.city)
  assert_nil(@address.plz)
end

- (Object) test_location__3



58
59
60
61
62
# File 'test/test_model/address2.rb', line 58

def test_location__3
  @address.location = 'CH-8006 Zürich'
  assert_equal('Zürich', @address.city)
  assert_equal('8006', @address.plz)
end

- (Object) test_location__4



63
64
65
66
67
# File 'test/test_model/address2.rb', line 63

def test_location__4
  @address.location = '6330 Cham 2'
  assert_equal('Cham 2', @address.city)
  assert_equal('6330', @address.plz)
end

- (Object) test_location_canton



68
69
70
71
72
# File 'test/test_model/address2.rb', line 68

def test_location_canton
  @address.location = '6330 Cham 2'
  @address.canton = 'ZG'
  assert_equal('6330 Cham 2 (ZG)', @address.location_canton)
end

- (Object) test_replace_with



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'test/test_model/address2.rb', line 107

def test_replace_with
  other = Address2.new
  other.title = 'Herrn Dr. med.'
  other.name = 'Werner Blaumacher'
  other.address = 'Schürmattstrasse 4b'
  other.location = '8706 Meilen'
  other.fon = ['041 154 32 64']
  other.fax = ['041 254 32 64']
  other.canton = 'SO'
  other.type = 'at_praxis'

  @address.name = 'Walter F. Hugentobler'
  @address.additional_lines = ['Arztpraxis', 
    'Praxisgemeinschaft Steinfels']
  @address.address = 'Burgweg 28'
  @address.location = '8706 Meilen'
  @address.fax = ['041 254 33 34']
  @address.type = 'at_work'

  @address.replace_with(other)

  assert_equal('Herrn Dr. med.', @address.title)
  assert_equal('Werner Blaumacher', @address.name)
  assert_equal([], @address.additional_lines)
  assert_equal('Schürmattstrasse 4b', @address.address)
  assert_equal('8706 Meilen', @address.location)
  assert_equal(['041 154 32 64'], @address.fon)
  assert_equal(['041 254 32 64'], @address.fax)
  assert_equal('SO', @address.canton)
  assert_equal('at_praxis', @address.type)
end

- (Object) test_search_terms



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'test/test_model/address2.rb', line 138

def test_search_terms
  @address.title = 'Herrn Dr. med.'
  @address.name = 'Werner Blaumacher'
  @address.additional_lines = [ 'Arztpraxis', 
  'Praxisgemeinschaft Steinfels' ]
  @address.address = 'Burgweg 28'
  @address.location = '8706 Meilen'
  expected = [
    'Werner Blaumacher',
    'Arztpraxis',
    'Praxisgemeinschaft Steinfels',
    'Burgweg 28',
    '8706 Meilen',
    'Meilen',
    '8706',
  ]
  assert_equal(expected, @address.search_terms)
end

- (Object) test_street__0



15
16
17
18
# File 'test/test_model/address2.rb', line 15

def test_street__0
  assert_nothing_raised { @address.street }
  assert_nothing_raised { @address.number }
end

- (Object) test_street__1



19
20
21
22
23
# File 'test/test_model/address2.rb', line 19

def test_street__1
  @address.address = 'Winterthurerstrasse 52'
  assert_equal('Winterthurerstrasse', @address.street)
  assert_equal('52', @address.number)
end

- (Object) test_street__2



24
25
26
27
28
# File 'test/test_model/address2.rb', line 24

def test_street__2
  @address.address = '13, Champs Elysees'
  assert_equal('Champs Elysees', @address.street)
  assert_equal('13', @address.number)
end

- (Object) test_street__3



29
30
31
32
33
# File 'test/test_model/address2.rb', line 29

def test_street__3
  @address.address = '13 Champs Elysees'
  assert_equal('Champs Elysees', @address.street)
  assert_equal('13', @address.number)
end

- (Object) test_street__4



34
35
36
37
# File 'test/test_model/address2.rb', line 34

def test_street__4
  @address.address = 'Champs Elysees'
  assert_nil(@address.number)
end

- (Object) test_street__5



38
39
40
41
42
# File 'test/test_model/address2.rb', line 38

def test_street__5
  @address.address = 'Bakerstreet 221a'
  assert_equal('Bakerstreet', @address.street)
  assert_equal('221a', @address.number)
end

- (Object) test_ydim_lines



156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'test/test_model/address2.rb', line 156

def test_ydim_lines
  @address.title = 'Herrn Dr. med.'
  @address.name = 'Werner Blaumacher'
  @address.additional_lines = [ 'Arztpraxis', 
  'Praxisgemeinschaft Steinfels' ]
  @address.address = 'Burgweg 28'
  @address.location = '8706 Meilen'
  expected = [
    'Burgweg 28',
    'Arztpraxis',
    'Praxisgemeinschaft Steinfels',
  ]
  assert_equal(expected, @address.ydim_lines)
end