Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.1.6
-
Fix Version/s: None
-
Component/s: Core Classes/Modules
-
Labels:None
-
Environment:JRuby 1.1.6, OS X, Java 1.5
-
Testcase included:yes
-
Number of attachments :
Description
Somehow, someway, the File.chmod method is failing when interacting with Dir.chdir and Test::Unit This sample program demonstrates the problem:
# test.rb
#
# Create this file as 'test/test.rb'
# Run from the parent directory, e.g. jruby test/test.rb
#
require 'test/unit'
class TC_Writable < Test::Unit::TestCase
def setup
Dir.chdir('test') # Comment this out and it works
@file = 'foo.doc'
File.open(@file, 'w'){}
end
def test_filetest
File.chmod(0644, @file)
assert_equal(true, File.writable?(@file))
File.chmod(0444, @file)
assert_equal(false, File.writable?(@file))
end
def teardown
File.delete(@file) if File.exists?(@file)
@file = nil
end
end
When I run standalone programs, however, it works fine. This leads me to believe there's some sort of interaction going on with Test::Unit, but I couldn' tell you what.
Regards,
Dan
BTW, here's my output: