Add "chdir" method. Can be used to avoid ruby warning "conflicting

chdir during another chdir block".
This commit is contained in:
Johan Holmberg 2009-08-14 14:05:06 +02:00
parent a533ee1300
commit 1f504f5f9b

View File

@ -115,6 +115,20 @@ module Cmdtest
FileUtils.touch(filename)
end
#------------------------------
# A "chdir" to be used in tests, to avoid the Ruby warning:
#
# warning: conflicting chdir during another chdir block
#
def chdir(dir, &block)
if block_given?
Util.chdir(dir, &block)
else
Dir.chdir(dir)
end
end
#------------------------------
# Don't count the specified file when calculating the "side effects"
# of a command.