[rspec-users] Assertions for asynchronous behaviour

Alex Chaffee alex at stinky.com
Tue Sep 20 18:38:48 EDT 2011

On Tue, Sep 20, 2011 at 4:55 AM, Matt Wynne <matt at mattwynne.net> 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 put it (or probably a hybrid
between your new code and my old code) into Wrong and you can use it
via the wrong rspec adapter.

def two

require "rspec"
require "wrong/adapters/rspec"
describe "two" do
  it "should eventually be half of four" do
    eventually { (two + two).should == 4 }

should work soonish...

Alex Chaffee - alex at stinky.com

More information about the rspec-users mailing list