Class: ODDB::TestPersistenceCreateItem

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
test/test_util/persistence.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



422
423
424
425
# File 'test/test_util/persistence.rb', line 422

def setup
  @pointer = ODDB::Persistence::Pointer.new([:fap, "fap"])
  @item = ODDB::Persistence::CreateItem.new(@pointer)
end

- (Object) teardown



426
427
428
# File 'test/test_util/persistence.rb', line 426

def teardown
  ODBA.cache = nil
end

- (Object) test_carry



429
430
431
432
433
434
435
# File 'test/test_util/persistence.rb', line 429

def test_carry
  @item.carry(:grok, "pak")
  assert_equal("pak", @item.grok)
  obj = Object.new
  @item.carry(:obj, obj)
  assert_equal(obj, @item.obj)
end

- (Object) test_create_oid_pointer



445
446
447
448
449
450
451
452
# File 'test/test_util/persistence.rb', line 445

def test_create_oid_pointer
  pointer = ODDB::Persistence::Pointer.new([:foo], [:shnup])
  item = ODDB::Persistence::CreateItem.new(pointer)
  app = StubPointerApp.new
  obj = app.update(item.pointer, {:zap => "moo"})
  assert_equal(StubPersistenceDiffable, obj.class)
  assert_equal('moo', obj.zap)
end

- (Object) test_create_pointer



436
437
438
439
440
441
442
443
444
# File 'test/test_util/persistence.rb', line 436

def test_create_pointer
  pointer = ODDB::Persistence::Pointer.new([:foo], [:car, 'rac'])
  item = ODDB::Persistence::CreateItem.new(pointer)
  app = StubPointerApp.new
  obj = app.update(item.pointer, {:urks => "moo"})
  assert_equal(StubPointerBar, obj.class)
  assert_equal('car', obj.bar)
  assert_equal('moo', obj.urks)
end

- (Object) test_pointer



453
454
455
456
457
458
459
460
# File 'test/test_util/persistence.rb', line 453

def test_pointer
  expected = ODDB::Persistence::Pointer.new([:create, @pointer])
  assert_equal(expected, @item.pointer)
  app = StubPointerApp2.new
  obj = app.update(@item.pointer, {:fap => 'paf'})
  assert_equal(StubPointerFap, obj.class)
  assert_equal('paf', obj.fap)
end

- (Object) test_respond_to_anything



461
462
463
464
465
# File 'test/test_util/persistence.rb', line 461

def test_respond_to_anything
  message = :undefinded_method
  assert_nothing_raised { @item.send(message) }
  assert_equal(nil, @item.send(message))
end