Oh and to answer your question Martin -

it's a fairly common step for both. Your absolute best bet is going to peepcode.com and watching all the vids on speccing. it should give you more than enough starting information about approach.

BTW - do any 'proper' tdd/bdd types here reccommend any specific books?

-james

On 16 Sep 2008, at 18:00, Martin Streicher wrote:


A few questions from someone new to rspec.

1/ I have several complex yet largely independent models using rspec to test internals and computation methods. I am about to tackle models that have several ties to each other and to the "primitive", independent models.

One model has stuff like this:

class Message ...
 belongs_to  :contact
 belongs_to  :topic
 has_one     :header
 has_many    :parts
 has_many    :attachments

My question:

What is the best practice for testing models with these interdependencies? What would you recommend for Message? What about Topic, which has_many Messages? Do I mock these? Use canonical data in the code rather than use a fixture?

2/ Related to (1), I have not found much documentation about such techniques. Pointers? Examples? Mentorship? Blogs?

3/ Has any documented how to run the debugger via rspec to help track down errors?

Martin



_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to