title: capybara/poltergeist doesn't refresh page after jQuery code in js.haml view renders partial in rspec
body: <p>I have search form where when a user types something in text box there is a js code that calls the controller and the search is made. Everything works OK in the browser but when I wrote rspec request spec about it in the test.log I can see that the code in index.js.haml is executed and the partial is rendered:
  jQuery("#agents_list").html("#{escape_javascript(render :partial => 'agents')}");</p>
  
  <p>but the spec fails because I make a search that should return no results but since before the search there are results on the page I take it that capybara does not refreshes the content of the page. </p>
  
  <p>I am with capybara 1.1.2 and the latest version of phantomjs and poltergeist.</p>
  
  <p>Can someone help me?</p>
  
  <p>EDIT: 
  spec code:</p>
  
  <pre><code>  before { go_to_merchants_and_click '' }
    let(:invalid_search) { 'some invalid'}
  
    it "by name", :js =&gt; true do
      fill_in 'query_value', :with =&gt; invalid_search
      trigger_search_for 'query_value'
      page.should have_no_content @merchant.name
  
      fill_in 'query_value', :with =&gt; @merchant.name
      trigger_search_for 'query_value'
      page.should have_content @merchant.name
  
      choose 'query_cond_name_contains'
      fill_in 'query_value', :with =&gt; invalid_search
      trigger_search_for 'query_value'
      page.should have_no_content @merchant.name
      fill_in 'query_value', :with =&gt; @merchant.name
      trigger_search_for 'query_value'
      page.should have_content @merchant.name
    end
  
  
    def trigger_search_for field_id
     page.execute_script("jQuery('##{field_id}').addClass('focused').trigger('keyup');")
   end
  </code></pre>