-TJ
I had a brief flirtation with RSpec after the testing tutorial at
RailsConf2007. It's nice but at the level I used it, there wasn't a
compelling difference compared to Test::Unit. The main thing I liked
about RSpec was that you could get an Englishy list of the tests that
were being run. Shoulda's 'rake shoulda:list' gives me that - in
addition to all its convenience methods. Another thing I like about
shoulda is that it uses Test::Unit so you can easily mix the scaffold
generated functional tests with custom tests of your own.
> > Hi I've been looking at rails for a while now and have written a
> > couple of simple app, I'm now about to start a larger app and what to
> > start testing my code, I've saw a presentation on shoulda at scotland
> > on rails and was impressed by how simple it seems. I'm now trying to
> > impliment tests in my code but this is something I've never done
> > before I've looked at the Rails way and AWDWD but can't seem to get my
> > head around how to start. Does anyone know of any very basic tutorials
> > to get me started or would people suggest I looked at RSPEC instead.
As TJ pointed out, the Thoughtbot/shoulda site has some good walk
throughs. Eventually I want to work my way up to the sort of macros
described in this article about 'embracing your inner slacker':
http://technicalpickles.com/posts/shoulda-macros-allows-you-to-embrace-your-inner-slacker
But that might be a bit much for starting.
One of the better Rails books for debugging and testing tips is
"RailsSpace"
http://www.amazon.com/RailsSpace-Building-Networking-Addison-Wesley-Professional/dp/0321480791
It was written pre-Rails 2, but late enough that the last couple of
chapters do use restful conventions.
Not a tutorial, but some interesting ideas on how to (and how not to)
test are in the Rails Way article "Testing the Right Stuff"
http://www.therailsway.com/2007/8/20/testing-the-right-stuff