Concerning fixtures I started with fixtures, then in my second attempt to be a good tester I used factory girl, that worked fine for me. In my current third attempt, after upgrading to rails 2.3.2, I do not know how to proceed.
I have a lot of dependencies, which makes fixtures very hard and time consuming to use, but you learn a lot about your application when you use them. (Are there any tools that generates fixtures considering all associations?). Most people tell you that you should use a factory approach instead (see e.g. the other replies about fixtures) and I am thinking of using machinist, but ..... I hesitate. The reason is that the rails developing team has selected the fixture approach (which are their reasons?) and the development of rails seems to follow that line. Is it not then wiser to go that way and take advantage of the improvements and tools that will be realized? So what to select factories or fixtures ????? On Apr 17, 2:52 pm, Fernando Perez <[email protected]> wrote: > My advise: > > - Don't bother with RSpec's hype. I tried it and got me pissed off so > many times. Don't care about autospec, it will distract you more than it > will help. Test::Unit is much better to use. AWDWR has a good enough > chapter to get you started. > > - Use mocha to mock and/or stub your method calls so that you test > objects as isolated as possible from other objects. > > - rcov can come in handy to know what parts of your app are not yet > tested. Be careful: 100% test coverage, doesn't mean your app is still > correctly tested. > > - Don't ever use fixtures at all! Run away from any person who tells you > they are fine, even if he is famous and rich. > > - Write your tests (even unit tests) so that they hit DB as least as > possible. When tests have to hit DB such as :include or :joins, then > setup sqlite in-memory for faster testing. > > - I have tried plenty factories: Machinist, factory girl, etc. I even > wrote my own, but once you understand how to write tests that don't hit > DB, you'll discover you will probably not need a factory at all. Except > when you must hit DB, it can be a little bit easier to insert valid > objects in DB. But at the beginning don't bother. > > - use a notifier plugin on your production server to catch any > additional edge case you haven't thought of (I use getexceptional), and > write tests to prevent against them in the future > > Writing tests is easy when you know how to write them and which tools to > use. > > Remember to have fun. If you are not having fun (even writing tests) > then something is wrong. > -- > Posted viahttp://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" 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/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

