title: Triggering angular directive from capybara/poltergeist feature test
body: <p>Capybara + Poltergeist are working fine for most of my feature tests in a rails 4 + angular app. However, I have problems testing code that uses the <a href="https://github.com/danialfarid/angular-file-upload" rel="nofollow">danielfard--angular-file-upload</a> JS library. My file upload code relies on a directive in that library called <code>ngFileSelect</code> <a href="https://github.com/danialfarid/angular-file-upload/blob/master/dist/angular-file-upload.js#L134" rel="nofollow">(source for the directive here)</a>. This works perfectly when I click through the process in the browser, but I can't get it to fire in my feature tests.</p>
  
  <p>My angular-ified HAML:</p>
  
  <pre><code>%input{ng: {"file-select" =&gt; "onFileSelect($files)"}, type: "file", multiple: true, id: "img-file-select"}
  </code></pre>
  
  <p>I tried using Capybara's <code>attach_file</code> method. This doesn't file but by watching the DB I can tell no upload is happening.</p>
  
  <pre><code>#does not fail but does not trigger upload
  attach_file "img-file-select", 
    ["#{Rails.root}/spec/fixtures/images/property.jpg",
    "#{Rails.root}/spec/fixtures/images/kitchen.jpg"]
  </code></pre>
  
  <p>I also tried using the <code>trigger</code> method to fire events manually. These do fail.</p>
  
  <pre><code>#these fail with with 'Capybara::Poltergeist::BrowserError: Unknown event [object Object]'
  find("#img-file-select").trigger('ngFileSelect')
  find("#img-file-select").trigger('fileSelect')
  find("#img-file-select").trigger('change')
  </code></pre>
  
  <p>Is there some way of firing this directive from a capybara test?</p>