Re: [rspec-users] Assertions for asynchronous behaviour

2011-10-13 Thread Alex Chaffee
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

Re: [rspec-users] Assertions for asynchronous behaviour

2011-10-02 Thread Matt Wynne
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/cae852f09a3d

Re: [rspec-users] Assertions for asynchronous behaviour

2011-09-27 Thread Alex Chaffee
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.co

Re: [rspec-users] Assertions for asynchronous behaviour

2011-09-21 Thread Alex Chaffee
On Wed, Sep 21, 2011 at 1:01 PM, Matt Wynne wrote: > I want a helpful error message when the test fails, rather than a crude > TimeoutError or whatever. I hear you. > I'm ambivalent about this: I would worry that allowing falsiness to cause an > assertion to be raised is not idiomatic RSpec, b

Re: [rspec-users] Assertions for asynchronous behaviour

2011-09-21 Thread Matt Wynne
On 21 Sep 2011, at 17:46, Alex Chaffee wrote: > There's a semantic issue in your eventually method that I'd like to > discuss. My wait_for[1] and friends take a *predicate* (in the form of > a block) and wait for it to return true(ish). Your eventually[2] > ignores the return condition, and merel

Re: [rspec-users] Assertions for asynchronous behaviour

2011-09-21 Thread Alex Chaffee
On Wed, Sep 21, 2011 at 3:42 AM, Matt Wynne wrote: > I've never used Wrong, only read about it--and I like the idea very much, I > must say. Is there any danger of adverse effects (other than an extra line > the Gemfile) if we have to use the Wrong RSpec adapter in the book alongside > the exis

Re: [rspec-users] Assertions for asynchronous behaviour

2011-09-21 Thread Matt Wynne
On 20 Sep 2011, at 23:38, Alex Chaffee wrote: > On Tue, Sep 20, 2011 at 4:55 AM, Matt Wynne wrote: >> Thanks for all the ideas. I just rolled my own which expects a block with an >> assertion in it: > > I love the language! > >eventually { white.should be_black } > >> Could we put this in

Re: [rspec-users] Assertions for asynchronous behaviour

2011-09-20 Thread Alex Chaffee
On Tue, Sep 20, 2011 at 4:55 AM, Matt Wynne wrote: > Thanks for all the ideas. I just rolled my own which expects a block with an > assertion in it: I love the language! eventually { white.should be_black } > Could we put this into RSpec somewhere? It's not actually RSpec-specific. I'll pu

Re: [rspec-users] Assertions for asynchronous behaviour

2011-09-20 Thread Matt Wynne
Thanks for all the ideas. I just rolled my own which expects a block with an assertion in it: https://gist.github.com/1228927 Could we put this into RSpec somewhere? I'd rather not dump the source into The Cucumber Book - it's too low level. I could put it into it's own little gem but that see

Re: [rspec-users] Assertions for asynchronous behaviour

2011-09-13 Thread Alex Chaffee
Sure. "wait_for" is a method Brian Takita and I originally wrote for use in Selenium tests, then IIRC it made it into the Selenium gem and now lots of libraries use it (or their own version -- I make no patent claim on polling :-)). The wait_for I remember allowed you to customize the failure messa

Re: [rspec-users] Assertions for asynchronous behaviour

2011-09-13 Thread Sidu Ponnappa
> the_object.should eventually_call(:foo).within(2).seconds TDDing multithreaded apps. Good times. Best, Sidu. http://blog.sidu.in On 13 September 2011 20:08, Justin Ko wrote: > > > On Tue, Sep 13, 2011 at 6:56 AM, Matt Wynne wrote: >> >> Hi all, >> In GOOS[1] they use an assertion called asser

Re: [rspec-users] Assertions for asynchronous behaviour

2011-09-13 Thread Justin Ko
On Tue, Sep 13, 2011 at 6:56 AM, Matt Wynne wrote: > Hi all, > > In GOOS[1] they use an assertion called assertEventually which samples the > system for a success state until a certain timeout has elapsed. This allows > you to synchronise the tests with asynchronous code. > > Do we have an equiva