title: Is there a better alternative to using sleep in Capybara?
body: <p>In my test I have a step where I fill out a field and press enter. This field then returns a result set on the next page.</p>
  
  <p>Here is my helper method:</p>
  
  <pre><code>def search(term)
    fill_in('query-text', :with =&gt; term)
    click_button('search-button')
  end
  </code></pre>
  
  <p>After that I have a step that simply says: </p>
  
  <pre><code>page.should have_content(tutor)
  </code></pre>
  
  <p>However, the issue is that even though the page after my page loads with the results, the step after it passes even if it should be false. I have set a debugger in the step and when I manually check it, the assertion fails as I expect it too. My assumption is that the the next step is checking before the page even reloads. I placed a sleep at the end of my search method to make it look like:</p>
  
  <pre><code>def search(term)
    fill_in('query-text', :with =&gt; term)
    click_button('search-button')
    sleep 5
  end
  </code></pre>
  
  <p>But I feel like using sleep is a hacky way to resolve this issue. I am using Capybara 2 so the use of wait_until is removed. Is there a better way to handle this issue rather than relying on sleep?</p>