On 5/4/06, Stefano Taschini <taschini.mlist / gmail.com> wrote:> On 02/05/06, John Wilger <johnwilger / gmail.com> wrote:> > However, one of the rules of agile unit testing is also that the tests> > must be able to run quickly (so that people will actually bother to> > run them).>> You are absolutely right. In fact, this is exactly how it is done in> rails when using transactional fixtures (which is the default> setting):
Then again, Eric's point holds true here as well. My biggest complaintwith Rails is that you can't truly _unit_ test your model classes. Notonly is it necessary to have a database connection, but it's also verydifficult to inject mocks in place of the other model classes that theclass under test is interacting with. In a better design, you wouldn't_need_ transactional fixtures, because you wouldn't be talking to areal database connection at all. This is one reason why I wasdisappointed that Jamis Buck's ideas for using dependency injection inRails never made it into the framework. Ruby itself doesn't really_need_ dependency injection, but I think it would have improved thisaspect of the Rails framework.
--Regards,John Wilgerhttp://johnwilger.com
-----------Alice came to a fork in the road. "Which road do I take?" she asked."Where do you want to go?" responded the Cheshire cat."I don't know," Alice answered."Then," said the cat, "it doesn't matter."- Lewis Carrol, Alice in Wonderland