2007/8/2, Kenneth McDonald <kenneth.m.mcdonald / sbcglobal.net>:
> If you saw an earlier version of this question, apologies...I haven't
> seen it, so assume I accidentally deleted it or it got lost or some such.
>
> In other languages, I'm accustomed to using "assert" as a sort of
> enforceable documentation. Is there an equivalent statement or idiom in
> Ruby? I find that simply raising exceptions isn't quite right;
> exceptions are normally used when one thinks something might be done
> about a problem, whereas asserts are used to check that something is the
> way it always should be. An 'assert' makes this point in the code. On a
> lazier note, an 'assert' also needs less typing :-).
>
> I know I could define an assert myself, but something like that should
> be universally, easily understood, not custom.
>

I am not sure if you mean Unit Testing or Design by Contract. Ruby has
a Unit Testing Library Test::Unit with many assertions. You can find
it the documentation here
http://www.ruby-doc.org/stdlib/libdoc/test/unit/rdoc/