Commit Graph

9 Commits

Author SHA1 Message Date
Robert Haines f033ae760d Use named parameters for `File::new`.
This is a breaking change, but now is the time to do this as we've
already done the same for `Entry::new`.
2021-06-27 10:20:11 +01:00
Robert Haines e10badf68e Fix Style/FrozenStringLiteralComment cop. 2021-05-25 21:24:50 +01:00
Robert Haines ce17c57e2d Fix Naming/AccessorMethodName in the tests.
This was kind of a misfire of this cop, but no bother to change.
2020-02-29 18:11:52 +00:00
Takumasa Ochi cf91112b57 Apply automatic correction by rubocop 2017-06-29 11:57:12 +09:00
Robert Haines b005c487b4 Clean up file permissions tests.
Now we don't differentiate between Windows and Linux in the library code for
this, we don't need separate tests.
2016-09-01 12:15:30 +01:00
Marcos Wright-Kuhns 4b27538818 Add a test helper for more human-readable file permission comparison
Before this change:
  1) Failure:
FilePermissionsTest#test_umask_027 [/Users/marcoswk/workspace/rubyzip/test/file_permissions_test.rb:52]:
Expected: 33184
  Actual: 33183

After this change:
  1) Failure:
FilePermissionsTest#test_umask_027 [/Users/marcoswk/workspace/rubyzip/test/file_permissions_test.rb:52]:
--- expected
+++ actual
@@ -1,2 +1,2 @@
 # encoding: US-ASCII
-"100640"
+"100637"
2016-06-30 14:47:41 -07:00
Marcos Wright-Kuhns 046b7f8f86 Add a failing test when the umask is 0027
This test fails because in *NIX when the umask is 0027, files are created with 0640 permissions. The current implementation of Zip::File.create_file_permissions does a simple subtraction of 0666 - 0027 == 0637
2016-06-30 14:43:52 -07:00
Marcos Wright-Kuhns b6896c4de3 Switch file_permission_test.rb to compare with File.open perms
...instead of comparing against in-ruby subtraction math.
2016-06-30 14:41:27 -07:00
Robert Haines 9acc50f004 Do something more expected with new file permissions.
Instead of inheriting the permissions from the tmp directory, new files should
have permissions that reflect the defaults on the system taking umask into
account.

It seems that (unix) permissions of 666 - umask are as close to a standard as
anything [1] and that 'touch' uses this. On Windows it seems sensible to just
use 644 directly [2].

[1] http://unix.stackexchange.com/a/102080
[2] http://ruby-doc.org/core-1.9.3/File.html
2015-06-24 18:25:22 +01:00