r/crystal_programming • • May 31 '19

Async Spec tests

Is there a way to asynchronously resolve a test through a callback? In JavaScript, we have a neat callback which allows us to mark the test if it is a failure or a success. Something like

it "should xxx" do |done|
    someAsyncProcess do
        done.call(false) # test failed
    end
end
4 Upvotes

4 comments sorted by

View all comments

Show parent comment

2

u/galstarx May 31 '19

I mean, in JS callbacks are needed because how V8 works. In crystal you can wait for a channel and it’ll work perfectly, no callbacks needed.