17 lines
313 B
Ruby
17 lines
313 B
Ruby
|
require "tempfile"
|
||
|
|
||
|
shared_context "unit" do
|
||
|
# This helper creates a temporary file and returns a Pathname
|
||
|
# object pointed to it.
|
||
|
def temporary_file(contents=nil)
|
||
|
f = Tempfile.new("vagrant-unit")
|
||
|
|
||
|
if contents
|
||
|
f.write(contents)
|
||
|
f.flush
|
||
|
end
|
||
|
|
||
|
return Pathname.new(f.path)
|
||
|
end
|
||
|
end
|