title: how to reset expectations on a mocked class method?
body: <p>Sorry if this is plain simple. i am new to ruby as well as rspec and it seems rspec is a very 'obscure' world (esp when coming from a .net background).</p>
  
  <p>In my 'spec', i have:</p>
  
  <pre><code>before(:each) do
      expect(File).to receive(:exist?).with("dummy.yaml").and_return (true)
  end
  </code></pre>
  
  <p>This works fine for all my 'examples', except one where i want it to return false.</p>
  
  <pre><code>expect(File).to receive(:exist?).with("non_existent.yaml").and_return (false)
  </code></pre>
  
  <p>This obviously fails my test because although "non_existent.yaml" expectation was met, the "dummy.yaml" was not:</p>
  
  <pre><code>(&lt;File (class)&gt;).exist?("dummy.yaml")
         expected: 1 time with arguments: ("dummy.yaml")
         received: 0 times
  </code></pre>
  
  <p>So how can i do a 'Reset' on 'File.exist?' (a class method mock) before i setup the new expectation for it? (... "non_existent.yaml"..)</p>
  
  <p>i googled and it yielded:</p>
  
  <pre><code>RSpec::Mocks.proxy_for(your_object).reset
  </code></pre>
  
  <p>but this gives me:</p>
  
  <pre><code>NoMethodError:
     undefined method `proxy_for' for RSpec::Mocks:Module
  </code></pre>