title: Cucumber/Capybara tests fail without save_and_open_page
body: <p>I have a Cucumber feature with matching step definitions like the following:</p>
  
  <p><strong>Feature:</strong></p>
  
  <pre><code>Feature: Time reporting
  
    @javascript
    Scenario: User reports billable time with valid data
      * I am signed in
      * the project I worked on exists in the system
      * I report 3 hours of work on the project
      * 3 hours should be logged in the system
  </code></pre>
  
  <p><strong>Steps:</strong></p>
  
  <pre><code>Given(/^the project I worked on exists in the system$/) do
    @company = FactoryGirl.create :company
    @project = FactoryGirl.create :project, company: @company
  end
  
  When(/^I report (\d+) hours of work on the project$/) do |hours|
    visit "/time-reporting/#{Date.today}"
    select_from_chosen @company.name, from: "company_id"
    select_from_chosen @project.name, from: "time_entry_project_id"
    page.evaluate_script("document.querySelector('#time_entry_hours').value = #{hours}")
    click_on "Report"
  end
  
  Then(/^(\d+) hours should be logged in the system$/) do |hours|
    #save_and_open_page
    expect(TimeEntry.last.hours).to eq hours.to_f
  end
  </code></pre>
  
  <p>This fails because, even though I’m saving the <code>TimeEntry</code> model in <code>TimeEntriesController</code>, the call to <code>TimeEntry.last</code> fails. It seems the model was not persisted.</p>
  
  <p>If, however, I uncomment <code>save_and_open_page</code>, the assertion works because it has now magically found the model.</p>
  
  <p>What is this voodoo?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I suspect this has something to do with Capybara-Webkit. If I interact with the page in some way, like this:</p>
  
  <pre><code>  expect(page.has_content?("3.0 hours were logged.")).to be true
  </code></pre>
  
  <p>…and I run the model assertion directly after it, then both assertions work just fine.</p>