refactor generator tests to use block form of Tempfile