title: Rails: Stub client-side ajax call in feature spec
body: <p>I'm writing an rspec feature spec to test a file upload page that sends files directly from the client to S3 using the <a href="https://github.com/waynehoover/s3_direct_upload" rel="nofollow">s3_direct_upload</a> gem. Instead of hitting S3, I'd like to stub out that link and return the correct response so I can test the behavior after a failed/successful ajax request.</p>
  
  <p>I think my issue lies in the fact that I can't use WebMock to stub requests, since the request isn't fired from the server (it's happening on the client).</p>
  
  <h3>Changing the test type/framework</h3>
  
  <p>I could add a new testing dependency like Jasmine or Sinon and test the js/page directly, but that still leaves me with feature specs that are trying to hit S3.</p>
  
  <h3>Changing the url</h3>
  
  <p>All of the bucket/path information for the link to S3 is bundled with the gem, so I would have to patch it in the test env, which I'd like to avoid.</p>
  
  <h2>Question</h2>
  
  <p>How I can run a feature spec that stubs out a client-side ajax request?</p>