Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
[ANN] assert_yin_yang
Phlip
5/24/2008 8:24:00 PM
This assertion extends assert{ 2.0 } to wrap this common testing
idiom:
q = method_that_might_return_41()
deny{ q == 42 }
q += method_that_should_return_one()
assert{ q == 42 }
The upgrade is:
q = method_that_might_return_41()
assert_yin_yang proc{ q += method_that_should_return_one() },
proc{ q == 42 }
In exchange for just a little verbosity, the expression q == 42 is now
more DRY.
Further, if q accidentally equals 42 before, or accidentally does not
equal it after the call to q += method_that_should_return_one(), the
assertion reflects the source code (but not the values!) of the
activation block.
Read more at:
http://assert2.rubyforge.org/assert_yin...
and get it with:
sudo gem install assert2
--
Phlip
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
[ANN] assert_yin_yang
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password