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. 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:



134
135
136
# File 'lib/lafcadio/mock.rb', line 134

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

Instance Method Details

#mock?Boolean

:nodoc:

Returns:

  • (Boolean)


140
141
142
# File 'lib/lafcadio/mock.rb', line 140

def mock? # :nodoc:
	true
end