dimanche 26 avril 2015

mongoid unit test without running mongodb

I recently started working with Mongoid using MongoLab. I don't actually have a local MongoDB instance running (and don't really need it). However, I want to unit test some of the document creation.

Is there an equivalent of SQLite for Mongo? Or some in-memory way to write tests for the business logic around the Mongoid document creation?

What I'd love to be able to do would be to call the main method of the class that creates the Mongoid documents, then introspect on the document structure/data without it persisting. But Mongoid doesn't seem to allow this, unless I'm missing something.

What is the best approach to test the structure/validations/relationships/etc. of Mongoid documents without running MongoDB or persisting them?

Aucun commentaire:

Enregistrer un commentaire