title: How to unstub Mocha mock?
body: <p>I have the following mocha mock that works great.</p>
  
  <p>In a test.rb file:</p>
  
  <pre><code>setup do
    Date.stubs(:today).returns(Date.new(2011, 7, 19)) 
    Time.stubs(:now).returns(Time.new(2011,1,1,9,0))
  end
  </code></pre>
  
  <p>The problem is that the timing is broken for the tests. After the tests run the date and time objects are still mocked.(!) </p>
  
  <p><code>Finished in -21949774.01594216 seconds.</code></p>
  
  <p>I added the following:</p>
  
  <pre><code>teardown do
    Date.unstubs(:today)
    Time.unstubs(:now)
  end
  </code></pre>
  
  <p>This throws the following error for each test: <code>WARNING:  there is already a transaction in progress</code></p>
  
  <p>Is this the proper way to unstub? Is it better to unstub at the end of the test file or even at the end of unit test suite?</p>
  
  <p>Working in Rails 3.07 and Mocha 0.9.12</p>
  
  <p>Thanks.</p>