[rspec-users] Assertions for asynchronous behaviour

Alex Chaffee alex at stinky.com
Thu Oct 13 15:52:00 EDT 2011


FYI, I've just released Wrong 0.6.0 with eventually "as is" -- i.e. no
extra exception message fiddling.

I also added a message param to Wrong's "d" method, e.g.

    d("math is hard") { 2 + 2 }

prints

    math is hard: (2 + 2) is 4

to the console. Useful for debugging (which is what "d" stands for)
when you don't want the test flow to stop with an assert or should.

 - A

-- 
Alex Chaffee - alex at stinky.com
http://alexchaffee.com
http://twitter.com/alexch

On Sun, Oct 2, 2011 at 2:02 PM, Matt Wynne <matt at mattwynne.net> wrote:
>
> On 28 Sep 2011, at 01:09, Alex Chaffee wrote:
>
>> After a week of stealing minutes, I eventually wrote eventually!
>> Please check this out and give me feedback. I can ship it in a new
>> Wrong gem as soon as you all tell me it's ready.
>>
>> docs:
>> https://github.com/alexch/wrong/commit/cae852f09a3d4dcb3f014b486a10d5eb7a10e7f5
>>
>> test (spec):
>> https://github.com/alexch/wrong/blob/master/test/eventually_test.rb
>>
>> code:
>> https://github.com/alexch/wrong/blob/master/lib/wrong/eventually.rb
>>
>> The only major feature I haven't done is editing the error message
>> from inside the block, since Wrong seems to do a good job of this on
>> its own. If the block contains a "should" or a Wrong "assert" then it
>> ends up looking like it just got called and failed the final time.
>> It'd be nice if I could sneak into an exception and append "(after 5
>> sec)" to e.message but I don't know if I want to go there...
>
> I haven't used it, but this looks good to me.
>
>>
>> --
>> Alex Chaffee - alex at stinky.com
>> http://alexchaffee.com
>> http://twitter.com/alexch
>> _______________________________________________
>> rspec-users mailing list
>> rspec-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users
>
> cheers,
> Matt
>
> --
> Freelance programmer & coach
> Author, http://pragprog.com/book/hwcuc/the-cucumber-book (with Aslak Hellesøy)
> Founder, http://relishapp.com
> +44(0)7974430184 | http://twitter.com/mattwynne
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list