[rspec-users] Preconditions

Geoffrey Wiseman geoffrey.wiseman at gmail.com
Fri Sep 7 16:07:05 EDT 2007

Sorry, lots of questions these days.

Is there a normal approach for preconditions?  In JUnit, I might put a few
assertions in the setUp() just to make sure that the test 'data' I've
created meets expectations before going to test it.

So, for instance, I've got an object that is audited using acts_as_audited
and I'd like to test the XML that results from model.revisions.to_xml().
I've created the object and modified it twice, so I expect there to be three
revisions, as far as the test goes.  It's not really a 'spec', because it's
not part of the contract that model objects have three revisions, it's just
something I want to make sure is true before I run off and conduct some

I could raise an exception in the before block if the precondition isn't
met, any other choices?

  - Geoffrey
Geoffrey Wiseman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070907/855c462c/attachment-0001.html 

More information about the rspec-users mailing list