Chapter 7. Testing

Table of Contents

Setting up testing in a Lafcadio-based program
Domain objects in test cases
Quicker ways to setup mock objects

Setting up testing in a Lafcadio-based program

Lafcadio's philosophy about testing is to try to mock out as much as possible, so that extensive database-dependent tests can be run through memory quickly. The primary engine behind that is the MockObjectStore, which pretends to be the ObjectStore representing the database.

mock_object_store = MockObjectStore.new
ObjectStore.set_object_store mock_object_store

Adding the above two lines to your test class' setup method will make every database-dependent call going through Lafcadio go through the virtual database.