Hi! I know you must be answering a lot of basic questions, sorry about that :-)
However I have not get it, how do you keep mocks updated without pain? I reached to the point where mocking things for view. I spec model-controller-view using "correct doc" way mocking-stubbing (plus I should run integration test to be sure that everything really works together). Now, when I want to change something in model then basically I have to change mocks so many places, haven't I? It really feels a little too messy for me as nuby rspecer. Or it's just my worry and you have to be so good that you don't have to change things too much after specing them? If so then I know that I should think much more when mocking(== designing) things. When I googled about this topic I have found similar worries out there and I got two solutions, where David [1] suggest to write integration tests (what should indicate that mocks are outdated) and Ryan [2] suggest to fall bact to fixtures. I feel I will fall back to fixtures, so no more designing fun with mocks but things feels more lightweight and practical :-) Or perhaps it's more up to project size and conditions... I don't know yet. Oki, [EMAIL PROTECTED] [1] http://blog.davidchelimsky.net/articles/2006/11/06/view-spec-tutorial "Now the risk here is that you could build a model that doesn't have a title field in it and your app will blow up! Admittedly, if you only write isolated, granular specs like this that risk is real. So you should be doing this in conjunction with integration testing." [2] http://railsforum.com/viewtopic.php?id=6528 "I took the past few hours and removed nearly all mocks from my specs. I also merged the controller and view specs into one using "integrate_views" in the controller spec. I am also loading all fixtures for each controller spec so there's some test data to fill the views. The end result? My specs are shorter, simpler, more consistent, less rigid, and they test the entire stack together (model, view, controller) so no bugs can slip through the cracks. I'm not saying this is the "right" way for everyone. If your project requires a very strict spec case then it may not be for you, but in my case this is worlds better than what I had before using mocks. I still think stubbing is a good solution in a few spots so I'm still doing that." _______________________________________________ rspec-users mailing list [email protected] http://rubyforge.org/mailman/listinfo/rspec-users
