diff options
author | Nobuyoshi Nakada <[email protected]> | 2019-12-18 13:35:58 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2019-12-18 13:35:58 +0900 |
commit | fcd8bafd086a7105b535ec1691f960e37d5c911b (patch) | |
tree | 0c95f5531d2b4a7243013aa08523c13dfc0612c6 | |
parent | c147eeff7c2b8d4b8864c8be6496abf7f622a983 (diff) |
Use a temporary file for chown test
Errno::EROFS may occur when the source tree is placed in a
read-only filesystem.
-rw-r--r-- | test/ruby/test_file.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/test/ruby/test_file.rb b/test/ruby/test_file.rb index 96e2ca291f..d570b6f6fb 100644 --- a/test/ruby/test_file.rb +++ b/test/ruby/test_file.rb @@ -233,11 +233,9 @@ class TestFile < Test::Unit::TestCase end def test_chown - assert_nothing_raised { - File.open(__FILE__) {|f| f.chown(-1, -1) } - } - assert_nothing_raised("[ruby-dev:27140]") { - File.open(__FILE__) {|f| f.chown nil, nil } + Tempfile.create("test-chown") {|f| + assert_nothing_raised {f.chown(-1, -1)} + assert_nothing_raised("[ruby-dev:27140]") {f.chown(nil, nil)} } end |