Class: ODDB::OdbaExporter::TestAcmedLine

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



238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# File 'ext/export/test/test_oddbdat.rb', line 238

def test_structure
  flexstub(Date).should_receive(:"today.strftime").and_return('20110203000000')
  package = ODDB::Package.new('12')
  flexstub(package) do |pack|
    pack.should_receive(:oid).and_return(123)
    pack.should_receive(:fachinfo).and_return(flexmock('fachinfo') do |fach|
      fach.should_receive(:oid).and_return('fachinfo.oid')
    end)
  end
  package.sequence = flexmock('sequence') do |seq|
    seq.should_receive(:atc_class).and_return(flexmock('atc_class') do |atc|
      atc.should_receive(:code).and_return('atc.code')
    end)
    seq.should_receive(:galenic_forms).and_return(flexmock('galenic_forms') do |gal|
      gal.should_receive(:first).and_return(flexmock('galform') do |form|
        form.should_receive(:oid).and_return('galform.oid')
      end)
    end)
  end
                                
  @acmedline = AcmedLine.new(package)
  expected = {
    1=>"02",
    2=>"20110203000000",
    3=>"1",
    4=>123,
    5=>"4",
    7=>"fachinfo.oid",
    10=>"atc.code",
    12=>"galform.oid",
  }
  assert_equal(expected.sort, @acmedline.structure.sort)
end