Add a helper for tests that use a temp dir

I factored out the common first step of all the tests into a helper which
clarifies the intent of each test by getting rid of extra setup "noise."