> To me, stubbing contradicts the R (you replace part of YOUR system; how can 
> the testing be reliable as it never runs your code).

And in certain circumstances this is exactly what you want to do, because you 
don't care about that part of your system.

Lately I've been doing the following:

Monkey patch ActiveRecord in spec_helper to raise if you try and write to the 
database, this forces you not to use it. It changes the way you structure some 
of your code, usually for the better, but ultimately it means you have a very 
fast unit test suite. These tests are fast, hundreds of tests per second fast.

Then in Cucumber I do everything through the user interface. If we need a user, 
we run the sign up process, then test whatever it was that required the user. 
Nothing gets into the database unless it came through the front end. This is 
slow, but exhaustively tests the full software stack. I tag every cucumber test 
with the model names and/or feature name involved, so that I can run the tests 
that I think might break locally before pushing, then I let a build server 
handle the full suite.

So far it's been working out well. 







-- 
You received this message because you are subscribed to the Google Groups "Ruby 
or Rails Oceania" 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/rails-oceania?hl=en.

Reply via email to