Get template output buffer instead of creating file

Just like the description says  :)

Added test to file_manipulation spec as well.