Permalink
Browse files

Use current umask when testing the expected file mode [#823 state:res…

…olved]

Signed-off-by: Joshua Peek <josh@joshpeek.com>
  • Loading branch information...
1 parent 3b9324e commit 3284fbb86629f398ba2634dd9369bc65beb7d6ae S. Brent Faulkner committed with josh Aug 14, 2008
Showing with 4 additions and 4 deletions.
  1. +4 −4 activesupport/test/core_ext/file_test.rb
@@ -29,15 +29,15 @@ def test_atomic_write_preserves_file_permissions
assert File.exist?(file_name)
end
assert File.exist?(file_name)
- assert_equal "100755", file_mode
+ assert_equal 0100755, file_mode
assert_equal contents, File.read(file_name)
File.atomic_write(file_name, Dir.pwd) do |file|
file.write(contents)
assert File.exist?(file_name)
end
assert File.exist?(file_name)
- assert_equal "100755", file_mode
+ assert_equal 0100755, file_mode
assert_equal contents, File.read(file_name)
ensure
File.unlink(file_name) rescue nil
@@ -50,7 +50,7 @@ def test_atomic_write_preserves_default_file_permissions
assert !File.exist?(file_name)
end
assert File.exist?(file_name)
- assert_equal "100644", file_mode
+ assert_equal 0100666 ^ File.umask, file_mode
assert_equal contents, File.read(file_name)
ensure
File.unlink(file_name) rescue nil
@@ -62,6 +62,6 @@ def file_name
end
def file_mode
- sprintf("%o", File.stat(file_name).mode)
+ File.stat(file_name).mode
end
end

0 comments on commit 3284fbb

Please sign in to comment.