Class: Lafcadio::MockObjectStore

Inherits:
ObjectStore
  • Object
show all
Defined in:
lib/lafcadio/mock.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. For example:

class SomeTestCase < Test::Unit::TestCase
  def setup
    @mock_object_store = Lafcadio::MockObjectStore.new
    Lafcadio::ObjectStore.set_object_store @mock_object_store
  end
end

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ObjectStore

#all, #db_bridge, db_name=, db_type, db_type=, #get, #get_map_object, #group_query, #initialize, #max, #method_missing, mock?, #query, #respond_to?, #transaction

Constructor Details

This class inherits a constructor from Lafcadio::ObjectStore

Dynamic Method Handling

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

Class Method Details

.db_bridgeObject

:nodoc:



122
123
124
# File 'lib/lafcadio/mock.rb', line 122

def self.db_bridge #:nodoc:
	MockDbBridge.new
end

Instance Method Details

#mock?Boolean

:nodoc:

Returns:

  • (Boolean)


128
129
130
# File 'lib/lafcadio/mock.rb', line 128

def mock? # :nodoc:
	true
end