Class: ODDB::TestFeedback

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



15
16
17
# File 'test/test_model/feedback.rb', line 15

def setup
  @feedback = .new
end

- (Object) test_init



18
19
20
21
22
23
24
# File 'test/test_model/feedback.rb', line 18

def test_init
  ptr = Persistence::Pointer.new :feedback
  @feedback.pointer = ptr
  @feedback.init
  assert_equal Persistence::Pointer.new([:feedback, @feedback.oid]), ptr
  assert_equal ptr, @feedback.pointer
end

- (Object) test_item_writer



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'test/test_model/feedback.rb', line 25

def test_item_writer
  item = flexmock 'item2'
  item.should_receive(:add_feedback).with(@feedback).times(1).and_return do
    assert true
  end
  res = @feedback.item = item
  assert_equal item, res
  assert_equal item, @feedback.item
  item.should_receive(:remove_feedback).with(@feedback).times(1).and_return do
    assert true
  end
  other = flexmock 'item2'
  other.should_receive(:add_feedback).with(@feedback).times(1).and_return do
    assert true
  end
  res = @feedback.item = other
  assert_equal other, res
  assert_equal other, @feedback.item
end