On Tue, May 26, 2009 at 12:25 AM, Rafael George <[email protected]> wrote: > > Hi guys, how can i test a model of DM without touching the database, > do you guys use mock objects or what, i can't find anything on the web > even for AC.
You can use in memory SQLite database like so DataMapper.setup(:default, "sqlite3::memory:") or use mocks, but I advice strongly to think one more time: I've seen apps where you can remove half of models from the hard drive and all tests still pass because of overused mocking and clever tricks like cutting the database off. Your deployed application does not run in a vacuum, it does interact with multiple data sources, and unfortunately they do not always behave nicely and things break along the integration way. So please do think twice before you start using in memory SQLite for tests or add mocks when in production mode you work with say Postgres and a few HTTP services. Some "best practices" are best used with extreme care or not used at all. -- MK --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/datamapper?hl=en -~----------~----~----~----~------~----~------~--~---
