diff --git a/mockery.cabal b/mockery.cabal
--- a/mockery.cabal
+++ b/mockery.cabal
@@ -1,13 +1,13 @@
--- This file has been generated from package.yaml by hpack.
+-- This file has been generated from package.yaml by hpack version 0.1.2.
 --
 -- see: https://github.com/sol/hpack
 
 name:           mockery
-version:        0.0.0
+version:        0.1.0
 synopsis:       Support functions for automated testing
 description:    Support functions for automated testing
 category:       Testing
-bug-reports:    https://github.com/sol/mockery/issues
+bug-reports:    https://github.com/hspec/mockery/issues
 author:         Simon Hengel <sol@typeful.net>
 maintainer:     Simon Hengel <sol@typeful.net>
 copyright:      (c) 2015 Simon Hengel
@@ -18,7 +18,7 @@
 
 source-repository head
   type: git
-  location: https://github.com/sol/mockery
+  location: https://github.com/hspec/mockery
 
 library
   hs-source-dirs: src
@@ -35,6 +35,8 @@
   type: exitcode-stdio-1.0
   hs-source-dirs: test
   main-is: Spec.hs
+  other-modules:
+      Test.Mockery.DirectorySpec
   build-depends:
       base == 4.*
     , temporary
diff --git a/src/Test/Mockery/Directory.hs b/src/Test/Mockery/Directory.hs
--- a/src/Test/Mockery/Directory.hs
+++ b/src/Test/Mockery/Directory.hs
@@ -1,11 +1,13 @@
 module Test.Mockery.Directory (
   inTempDirectory
 , inTempDirectoryNamed
+, withFile
 ) where
 
 import           Control.Exception
 import           System.Directory
-import           System.IO.Temp (withSystemTempDirectory)
+import           System.IO hiding (withFile)
+import           System.IO.Temp (withSystemTempDirectory, withSystemTempFile)
 
 -- |
 -- Run given action with the current working directory set to a temporary
@@ -15,7 +17,7 @@
 -- completed the directory is removed and the current working directory is
 -- restored to its original value.
 inTempDirectory :: IO a -> IO a
-inTempDirectory action = withSystemTempDirectory "hspec" $ \path -> do
+inTempDirectory action = withSystemTempDirectory "mockery" $ \path -> do
   bracket getCurrentDirectory setCurrentDirectory $ \_ -> do
     setCurrentDirectory path
     action
@@ -28,3 +30,14 @@
   createDirectory name
   setCurrentDirectory name
   action
+
+-- |
+-- Create a temporary file with the given contents and execute the given
+-- action.
+--
+-- The file is removed after the action has completed.
+withFile :: String -> (FilePath -> IO a) -> IO a
+withFile input action = withSystemTempFile "mockery" $ \file h -> do
+  hPutStr h input
+  hClose h
+  action file
diff --git a/test/Test/Mockery/DirectorySpec.hs b/test/Test/Mockery/DirectorySpec.hs
new file mode 100644
--- /dev/null
+++ b/test/Test/Mockery/DirectorySpec.hs
@@ -0,0 +1,13 @@
+
+module Test.Mockery.DirectorySpec where
+
+import           Test.Hspec
+
+import           Test.Mockery.Directory
+
+spec :: Spec
+spec = do
+  describe "withFile" $ do
+    it "creates a temporary file with the given contents" $ do
+      withFile "foo" $ \file ->
+        readFile file `shouldReturn` "foo"
