Class: ODDB::OdbaExporter::TestAcLine

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) setup



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'ext/export/test/test_oddbdat.rb', line 51

def setup
  @package = ODDB::Package.new('12')
  @registration = flexmock('registration') do |mock|
    mock.should_receive(:generic_type).and_return(:generic)
    #mock.should_receive(:registration_date).and_return(Date.today)
    mock.should_receive(:registration_date).and_return(Date.new(2011,2,3))
  end
  @package.sequence = flexmock('sequence') do |seq|
    seq.should_receive(:registration).and_return @registration
    seq.should_receive(:iksnr).and_return('12345')
  end
  @package.create_sl_entry 
  @package.sl_entry.limitation = 'limitation'
  @package.sl_entry.limitation_points = 5
  flexstub(@package).should_receive(:oid).and_return(123)
  flexstub(Date).should_receive(:"today.strftime").and_return('20110203000000')
  @acline = AcLine.new(@package)
end

- (Object) test_generic_code



69
70
71
# File 'ext/export/test/test_oddbdat.rb', line 69

def test_generic_code
  assert_equal('Y', @acline.generic_code(@registration))
end

- (Object) test_iks_date



72
73
74
75
# File 'ext/export/test/test_oddbdat.rb', line 72

def test_iks_date
  expected = '20110203'
  assert_equal(expected, @acline.iks_date(@registration))
end

- (Object) test_ikskey



76
77
78
# File 'ext/export/test/test_oddbdat.rb', line 76

def test_ikskey
  assert_equal('12345012', @acline.ikskey)
end

- (Object) test_inscode



79
80
81
# File 'ext/export/test/test_oddbdat.rb', line 79

def test_inscode
  assert_equal('1', @acline.inscode)
end

- (Object) test_limitation



82
83
84
# File 'ext/export/test/test_oddbdat.rb', line 82

def test_limitation
  assert_equal('Y', @acline.limitation)
end

- (Object) test_limitation_points



85
86
87
# File 'ext/export/test/test_oddbdat.rb', line 85

def test_limitation_points
  assert_equal(5, @acline.limitation_points)
end

- (Object) test_structure



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'ext/export/test/test_oddbdat.rb', line 88

def test_structure
  expected = {
    1 =>"01",
    2 =>"20110203000000",
    3 =>"1",
    4 =>123,
    5 =>"4",
    7 =>"12345012",
    14=>nil,
    20=>"Y",
    22=>"20110203",
    29=>"3",
    32=>nil,
    39=>"1",
    40=>"Y",
    41=>5,
    47=>nil,
  }

  # test
  assert_equal(expected.sort, @acline.structure.sort)
end