Fix persisted cache specs.

Also use File.join to generate paths, and get temp dir location from
Dir.tmpdir.