Class: Lafcadio::MockObjectStore

Inherits:
ObjectStore show all
Defined in:
lib/lafcadio/mock/MockObjectStore.rb

Overview

Externally, the MockObjectStore looks and acts exactly like the ObjectStore, but stores all its data in memory. This makes it very useful for unit testing, and in fact LafcadioTestCase#setup creates a new instance of MockObjectStore for each test case.

Instance Method Summary collapse

Methods inherited from ObjectStore

#commit, #flush, #get, #getAll, #getDbBridge, #getFiltered, #getMapMatch, #getMapObject, #getMapped, #getMax, #getObjects, #getSubset, #last_commit_time, #method_missing, #set, setDbName, #updateCacheAfterCommit

Methods inherited from ContextualService

method_missing

Constructor Details

#initialize(context) ⇒ MockObjectStore

:nodoc:



12
13
14
# File 'lib/lafcadio/mock/MockObjectStore.rb', line 12

def initialize(context) # :nodoc:
	super(context, MockDbBridge.new)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Lafcadio::ObjectStore

Instance Method Details

#addObject(dbObject) ⇒ Object

:nodoc:



16
17
18
# File 'lib/lafcadio/mock/MockObjectStore.rb', line 16

def addObject(dbObject) # :nodoc:
	commit dbObject
end