Class: ODDB::OdbaExporter::TestCompLine

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) test_structure



396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
# File 'ext/export/test/test_oddbdat.rb', line 396

def test_structure
  company = flexmock('company') do |comp|
    comp.should_receive(:oid).and_return('oid')
    comp.should_receive(:ean13).and_return('ean13')
    comp.should_receive(:name).and_return('name')
    comp.should_receive(:address_email).and_return('address_email')
    comp.should_receive(:url).and_return('url')
    comp.should_receive(:address).and_return(flexmock('addr') do |addr|
      addr.should_receive(:address).and_return('address')
      addr.should_receive(:plz).and_return('plz')
      addr.should_receive(:city).and_return('city')
      addr.should_receive(:"fon.first").and_return('fon.first')
      addr.should_receive(:"fax.first").and_return('fax.first')
    end)
  end
  flexstub(Date).should_receive(:"today.strftime").and_return('20110203000000')
  @compline = CompLine.new(company)
  expected = {
    1=>"12",
    2=>"20110203000000",
    3=>"oid",
    4=>"4",
    5=>"ean13",
    7=>"name",
    8=>"address",
    9=>"CH",
    10=>"plz",
    11=>"city",
    13=>"fon.first",
    15=>"fax.first",
    16=>"address_email",
    17=>"url",
  }
  assert_equal(expected.sort, @compline.structure.sort)
end