I have this test case:
it 'should create new request from ajax form', js: true do
visit root_path
click_on 'new-order-link'
expect {
click_on 'submit-request'
}.to change(Request, :count)
end
But I'm getting message, that count didn't changed. I suppose, that problem with async. When I add sleep(3)
after click_on call, everything ok and test passed. But it's sound bad, that I should add sleep call in every test case with ajax.