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