aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorThibault Jouan <tj@a13.fr>2012-05-29 20:31:21 +0000
committerThibault Jouan <tj@a13.fr>2012-05-29 21:01:03 +0000
commit7b6bf02303e91932fd3c5824e88f7a58424a7b60 (patch)
treee2f0058f95fb2fa74544dda01ea5fad6cf2cf7df /activesupport/test
parent70ad12a72fe3151fd548e9a37a84b54060fcdbba (diff)
downloadrails-7b6bf02303e91932fd3c5824e88f7a58424a7b60.tar.gz
rails-7b6bf02303e91932fd3c5824e88f7a58424a7b60.tar.bz2
rails-7b6bf02303e91932fd3c5824e88f7a58424a7b60.zip
Make File#atomic_write tests pass with umask
Assertions on file permissions only pass with some combinations of file create mode and the process file mode creation mask. This mask should be applied on the file create mode before related assertions.
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/file_test.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activesupport/test/core_ext/file_test.rb b/activesupport/test/core_ext/file_test.rb
index 50c9c57aa6..128e956a8c 100644
--- a/activesupport/test/core_ext/file_test.rb
+++ b/activesupport/test/core_ext/file_test.rb
@@ -30,7 +30,7 @@ class AtomicWriteTest < ActiveSupport::TestCase
assert File.exist?(file_name)
end
assert File.exist?(file_name)
- assert_equal 0100755, file_mode
+ assert_equal 0100755 & ~File.umask, file_mode
assert_equal contents, File.read(file_name)
File.atomic_write(file_name, Dir.pwd) do |file|
@@ -38,7 +38,7 @@ class AtomicWriteTest < ActiveSupport::TestCase
assert File.exist?(file_name)
end
assert File.exist?(file_name)
- assert_equal 0100755, file_mode
+ assert_equal 0100755 & ~File.umask, file_mode
assert_equal contents, File.read(file_name)
ensure
File.unlink(file_name) rescue nil
@@ -51,7 +51,7 @@ class AtomicWriteTest < ActiveSupport::TestCase
assert !File.exist?(file_name)
end
assert File.exist?(file_name)
- assert_equal 0100666 ^ File.umask, file_mode
+ assert_equal 0100666 & ~File.umask, file_mode
assert_equal contents, File.read(file_name)
ensure
File.unlink(file_name) rescue nil