2012-03-11 18:19:06 -04:00
|
|
|
require 'test/unit'
|
|
|
|
require 'tmpdir'
|
|
|
|
|
|
|
|
class TestTmpdir < Test::Unit::TestCase
|
|
|
|
def test_world_writable
|
2012-03-14 03:42:30 -04:00
|
|
|
skip "no meaning on this platform" if /mswin|mingw/ =~ RUBY_PLATFORM
|
2012-03-11 18:19:06 -04:00
|
|
|
Dir.mktmpdir do |tmpdir|
|
|
|
|
# ToDo: fix for parallel test
|
|
|
|
olddir, ENV["TMPDIR"] = ENV["TMPDIR"], tmpdir
|
|
|
|
begin
|
|
|
|
assert_equal(tmpdir, Dir.tmpdir)
|
|
|
|
File.chmod(0777, tmpdir)
|
|
|
|
assert_not_equal(tmpdir, Dir.tmpdir)
|
|
|
|
File.chmod(01777, tmpdir)
|
|
|
|
assert_equal(tmpdir, Dir.tmpdir)
|
|
|
|
ensure
|
|
|
|
ENV["TMPDIR"] = olddir
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|