Class: ODDB::TestAddressObserver

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

Defined Under Namespace

Classes: Observer

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



194
195
196
197
198
# File 'test/test_model/address2.rb', line 194

def setup
  @observer = Observer.new
  @address1 = @observer.create_address
  @address2 = @observer.create_address
end

- (Object) test_address



199
200
201
202
203
204
205
206
# File 'test/test_model/address2.rb', line 199

def test_address
  assert_equal @address1, @observer.address(0)
  assert_equal @address2, @observer.address(1)
  assert_equal @address1, @observer.address('0')
  assert_equal @address2, @observer.address('1')
  assert_nil @observer.address(2)
  assert_nil @observer.address('2')
end

- (Object) test_address_item



207
208
209
210
211
212
213
214
# File 'test/test_model/address2.rb', line 207

def test_address_item
  @address1.name = 'A Name'
  @address2.name = 'Another Name'
  @address2.address = 'The First Line'
  assert_equal 'A Name', @observer.address_item(:name, 0)
  assert_equal 'Another Name', @observer.address_item(:name, 1)
  assert_equal 'The First Line', @observer.address_item(:address, 1)
end

- (Object) test_ydim_address_lines



215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'test/test_model/address2.rb', line 215

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

- (Object) test_ydim_location



229
230
231
232
233
234
235
236
237
# File 'test/test_model/address2.rb', line 229

def test_ydim_location
  @address2.title = 'Herrn Dr. med.'
  @address2.name = 'Werner Blaumacher'
  @address2.additional_lines = [ 'Arztpraxis', 
    'Praxisgemeinschaft Steinfels' ]
  @address2.address = 'Burgweg 28'
  @address2.location = '8706 Meilen'
  assert_equal('8706 Meilen', @observer.ydim_location(1))
end