Class: ODDB::Migel::TestGroup

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



16
17
18
# File 'test/test_model/migel_group.rb', line 16

def setup
  @group = ODDB::Migel::Group.new('02')
end

- (Object) test_checkout



19
20
21
22
23
24
25
26
27
28
29
# File 'test/test_model/migel_group.rb', line 19

def test_checkout
  subgroup = flexmock 'subgroup'
  @group.subgroups.store 'subgroup', subgroup
  assert_raises RuntimeError do
    @group.checkout
  end
  @group.subgroups.clear
  assert_nothing_raised do
    @group.checkout
  end
end

- (Object) test_create_limitation_text



30
31
32
33
34
35
# File 'test/test_model/migel_group.rb', line 30

def test_create_limitation_text
  assert_nil @group.limitation_text
  res = @group.create_limitation_text
  assert_instance_of LimitationText, res
  assert_equal res, @group.limitation_text
end

- (Object) test_create_subgroup



36
37
38
39
40
41
42
43
# File 'test/test_model/migel_group.rb', line 36

def test_create_subgroup
  subgroup = @group.create_subgroup('02')
  assert_instance_of(Subgroup, subgroup)
  assert_equal({'02' => subgroup}, @group.subgroups)
  assert_equal('02', @group.code)
  assert_equal(@group, subgroup.group)
  assert_equal(subgroup, @group.subgroup('02'))
end

- (Object) test_delete_limitation_text



44
45
46
47
48
49
# File 'test/test_model/migel_group.rb', line 44

def test_delete_limitation_text
  lt = flexmock :odba_delete => true
  @group.instance_variable_set '@limitation_text', lt
  @group.delete_limitation_text
  assert_nil @group.limitation_text
end

- (Object) test_delete_subgroup



50
51
52
53
54
55
# File 'test/test_model/migel_group.rb', line 50

def test_delete_subgroup
  @group.subgroups.store '02', 'subgroup'
  res = @group.delete_subgroup '02'
  assert_equal 'subgroup', res
  assert_equal({}, @group.subgroups)
end

- (Object) test_migel_code



56
57
58
# File 'test/test_model/migel_group.rb', line 56

def test_migel_code
  assert_equal '02', @group.migel_code
end