Class: ODDB::TestSlEntry

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



18
19
20
# File 'test/test_model/slentry.rb', line 18

def setup
  @sl_entry = ODDB::SlEntry.new
end

- (Object) test_adjust_types



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'test/test_model/slentry.rb', line 21

def test_adjust_types
  values = {
    :introduction_date  => '01.02.2003',
    :limitation       => 'Y',
    :limitation_points  => '23',
  }
  expected = {
    :introduction_date  => Date.new(2003, 2, 1),
    :limitation       => true,
    :limitation_points  => 23,
  }
  assert_equal(expected, @sl_entry.adjust_types(values))
  values = {
    :introduction_date  => Date.new(2003, 2, 1),
    :limitation       => true,
    :limitation_points  => '23',
  }
  expected = {
    :introduction_date  => Date.new(2003, 2, 1),
    :limitation       => true,
    :limitation_points  => 23,
  }
  assert_equal(expected, @sl_entry.adjust_types(values))
  values = {
    :limitation       => '',
    :limitation_points  => '0',
  }
  expected = {
    :limitation       => false,
    :limitation_points  => nil,
  }
  assert_equal(expected, @sl_entry.adjust_types(values))
end

- (Object) test_create_limitation_text



54
55
56
57
58
# File 'test/test_model/slentry.rb', line 54

def test_create_limitation_text
  txt = @sl_entry.create_limitation_text
  assert_instance_of LimitationText, txt
  assert_equal txt, @sl_entry.limitation_text
end

- (Object) test_delete_limitation_text



59
60
61
62
63
# File 'test/test_model/slentry.rb', line 59

def test_delete_limitation_text
  @sl_entry.instance_variable_set '@limitation_text', 'a text'
  @sl_entry.delete_limitation_text
  assert_nil @sl_entry.limitation_text
end

- (Object) test_pointer_descr



64
65
66
# File 'test/test_model/slentry.rb', line 64

def test_pointer_descr
  assert_equal :sl_entry, @sl_entry.pointer_descr
end