From 7b6bf02303e91932fd3c5824e88f7a58424a7b60 Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Tue, 29 May 2012 20:31:21 +0000 Subject: 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. --- activesupport/test/core_ext/file_test.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'activesupport/test') 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 -- cgit v1.2.3