Just came across an RSpec controller test that stubbed
File.stat like so:
This was a problem, because elsewhere in the same controller action I needed to use unstubbed
File.stat with other files. The solution is pretty simple:
Now any calls to
File.stat will behave normally, unless the filename is
some/file.txt, in which case you'll get the mock!