title: Correct way to double a class instance with RSpec?
body: <p>I'm trying to make a test double for a class instance with RSpec.  Say I have a test that only accepts a File object as an argument.  </p>
  
  <p>Great, now how do I make a double so I don't have to pass in an actual file with all of my specs?</p>
  
  <pre><code>let(:file) { double(File) }
  raise "NOT A FILE" unless file.is_a? File
  # =&gt; RuntimeError: NOT A FILE
  </code></pre>
  
  <p>I've also tried this:</p>
  
  <pre><code>let(:file) { instance_double(File) }
  raise "NOT A FILE" unless file.is_a? File
  # =&gt; RuntimeError: NOT A FILE
  </code></pre>
  
  <p>And this (which is expecting an actual file):</p>
  
  <pre><code>let(:file) { object_double(File.new) }
  # =&gt; ArgumentError: wrong number of arguments
  </code></pre>
  
  <p>What am I doing wrong?</p>