Given the example sinatra app
post '/1' do
sleep(1) until @2
0
end
post '/2' do
@2 = true
0
end
and the example RSpec test
describe 'test' do
it 'does /1' do
post '/1'
expect(last_response.body) to eq?(0)
end
it 'does /2'
post '/2'
expect(last_response.body) to eq?(0)
end
end
The first test (it does /1
) will hang, waiting for /2 to be called.
Is it possible to tell RSpec to not wait for the outcome of test #1 to complete before beginning test #2? A.K.A, are asynchronous tests possible in RSpec?