title: Test file download with Capybara and Cucumber
body: <p>I am trying to test a download using Capybara and Cucumber. </p>
  
  <p>The test steps look like:</p>
  
  <pre><code>When(/^I export to CSV$/) do
    export_button = find("div.results-table input[type=\"submit\"]")
  
    export_button.click
  end
  
  Then(/^I should be prompted to download the CSV$/) do
    Capybara.current_driver = :webkit #switch driver so we can see the response_headers
    page.response_headers['Content-Disposition'].should include("filename=\"transactions\"")
  end
  </code></pre>
  
  <p>I had to add the capybara webkit driver in the middle of the test so that I can use the response_headers, but the response_headers seem to return an empty object. I am using the default driver before that because I need to click the button, but I wonder if switching drivers like this is why I am not getting anything in the response_header?</p>