Cleanup temporary directory after running
This commit is contained in:
parent
4c6f8d2b52
commit
a19fa6a07c
|
@ -47,4 +47,8 @@ class AcceptanceTest < Test::Unit::TestCase
|
|||
apps = { "vagrant" => config.vagrant_path }
|
||||
@environment = Acceptance::IsolatedEnvironment.new(apps, config.env)
|
||||
end
|
||||
|
||||
teardown do
|
||||
@environment.close
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,6 +12,9 @@ module Acceptance
|
|||
class IsolatedEnvironment
|
||||
include POSIX::Spawn
|
||||
|
||||
attr_reader :homedir
|
||||
attr_reader :workdir
|
||||
|
||||
# Initializes an isolated environment. You can pass in some
|
||||
# options here to configure runing custom applications in place
|
||||
# of others as well as specifying environmental variables.
|
||||
|
@ -55,6 +58,12 @@ module Acceptance
|
|||
|
||||
return ExecuteProcess.new(status.exitstatus, stdout, stderr)
|
||||
end
|
||||
|
||||
# Closes the environment, cleans up the temporary directories, etc.
|
||||
def close
|
||||
# Delete the temporary directory
|
||||
FileUtils.rm_rf(@tempdir.path)
|
||||
end
|
||||
end
|
||||
|
||||
# This class represents a process which has run via the IsolatedEnvironment.
|
||||
|
|
Loading…
Reference in New Issue