Commit Graph

97 Commits

Author SHA1 Message Date
Oleksandr Simonov 8887b70349
Merge pull request #361 from hainesr/quiet-tests
Turn off all terminal output in all tests.
2018-04-23 22:18:31 +03:00
Robert Haines cd7bb142a4 Turn off all terminal output in all tests.
Makes things a lot easier when trying to track down bugs.
2018-04-04 19:45:54 +01:00
Robert Haines 84c208982f Switch newly created StringIOs to binmode.
StringIO objects created within File.open_buffer were not being switched into
binmode, but those passed in were. Fix this inconsistency and add a test.
2018-04-04 16:02:19 +01:00
Robert Haines 15ccc25da1 Fix File.open_buffer when no changes are made.
Things are now more carefully set up, and if a buffer is passed in which
represents a file that already exists then this is taken into account. All
initialization is now done in File.new, rather than being split between there
and File.open_buffer.

This has also needed a bit of a re-write of Zip::File.initialize. I've tried to
bring some logic to it as a result, and have added comments to explain what is
now happening.
2018-04-04 15:54:12 +01:00
Andrew Meyer c787d94852 Handle stored files with general purpose bit 3 set
Signed-off-by: Sam Coward <scoward@pivotal.io>
2018-04-03 16:07:18 -04:00
Phil 792266dbf3 Added fix for calling 'close' on a StringIO-backed zip file, and specs 2018-02-21 11:48:56 -08:00
Takumasa Ochi cf91112b57 Apply automatic correction by rubocop 2017-06-29 11:57:12 +09:00
mwlang 14b8fed18c allows open_buffer to work without a given block 2017-01-16 13:24:22 -06:00
David Rodríguez f157dfc1b6 Revert "Cleanup after ourselves"
This reverts commit 6597af1257 since
7caab1f already fixed the same thing. It should fix the build.
2016-11-10 08:23:34 -02:00
Alexander Simonov a0cf673186 Merge pull request #300 from hainesr/fix-create-perms
Fix permissions on new zip files (#294)
2016-11-09 22:19:04 +02:00
Alexander Simonov 82fa57cc83 Merge pull request #303 from deivid-rodriguez/extended_globbing
Extended globbing
2016-11-09 22:17:17 +02:00
David Rodríguez 6597af1257 Cleanup after ourselves
Otherwise tests leave an empty file there.
2016-10-08 19:23:45 -03:00
David Rodríguez 366a1d8dca Fix test failure when running a single test file
```
bundle exec rake TEST=test/file_test.rb
```

was giving

```
  1) Error:
ZipFileTest#test_get_output_stream:
NameError: uninitialized constant ZipFileTest::ZipEntryTest
    .../test/file_test.rb:59:in `block in test_get_output_stream'
    .../lib/zip/file.rb:102:in `open'
    .../test/file_test.rb:45:in `test_get_output_stream'
```
2016-10-08 19:21:30 -03:00
Robert Haines fc23f68f77 Refactor the create logic in Zip::File.
Make the internal @create varible more consistent and actually match the
documentation.

Zip::File::CREATE is now true, rather than 1.

A new test is added to check if passing 1 in still works to ensure backwards
compatibility.
2016-09-05 15:16:57 +01:00
Robert Haines 7caab1f467 Clean up empty.zip after running tests.
After running the tests there was a file left in the project directory,
'empty.zip', which was simply 'touch'ed to use as a null file. Switch to create
this as one of the generated test files so it's cleaned up automatically.

Also, use 'null.zip' as the name as there is already an 'empty.zip' generated
that is a zip file, but empty.
2016-08-28 12:17:17 +01:00
Oleksandr Avoiants 73bfa5955c Fix TypeError: can't dup NilClass from EntrySet#dup 2015-12-19 11:26:20 +02:00
Victor Costan 77acc03ddb Fix exception due to calling empty? on nil. 2015-09-30 03:57:21 -04:00
Claire Pitman a1f75a3ab9 Added error for empty (zero bit) zip file. Added tests for empty and non existant zips 2015-07-27 23:20:59 -07:00
Victor Costan 37a5baad96 Accept StringIO in Zip.open_buffer. 2015-07-02 14:17:17 -04:00
Pavel Lobashov 4c81b1151a fix rubocop cop Style/NilComparison 2015-06-08 10:30:12 +03:00
Pavel Lobashov ce7e01a206 fix rubocop Style/CommentIndentation cop 2015-03-24 19:31:28 +03:00
Pavel Lobashov b9aefaffb5 fix rubocop Style/IfUnlessModifier cop 2015-03-24 19:09:22 +03:00
Pavel Lobashov 23cfcc73b5 fix rubocop Style/MethodName cop 2015-03-24 19:02:54 +03:00
Pavel.Lobashov 8d6f23ba9a fix rubocop Style/SpaceAroundOperators cop 2015-03-22 20:03:50 +03:00
Pavel.Lobashov d92d8d652a fix rubocop Style/SpaceInsideParens cop 2015-03-22 19:56:37 +03:00
Pavel.Lobashov b311998e25 fix rubocop Style/SpaceInsideBlockBraces cop 2015-03-22 19:49:07 +03:00
Pavel Lobashov b93ef1266f fix rubocop Style/StringLiterals cop 2015-03-21 11:27:44 +03:00
Pavel Lobashov eba5fa1983 fix rubocop Style/EmptyLinesAroundAccessModifier cop 2015-03-21 11:19:43 +03:00
Pavel Lobashov d0c8e8df60 fix rubocop Style/EmptyLines cop 2015-03-21 11:19:14 +03:00
Pavel Lobashov 6c46c21abb fix rubocop Style/ColonMethodCall cop 2015-03-21 11:16:06 +03:00
Pavel Lobashov d2d8590ef8 fix rubocop Style/Blocks cop 2015-03-21 11:10:37 +03:00
Pavel.Lobashov 7ef15bd201 fix rubocop Lint/UselessAssignment cop 2015-03-20 23:13:38 +03:00
Alexander Simonov 002959f2e2 Add tests from #182 for testing tempfile as IO for OutputStream::write_buffer 2015-02-02 23:40:52 +02:00
Robert Haines 4b943fb263 Remove unused variable 'comment' in file_test.rb. 2014-07-23 12:59:14 +03:00
Robert Haines 9e642acdc9 Don't use deprecated File.exists? in tests. 2014-07-23 12:59:14 +03:00
Robert Haines 8100cf69a0 Clean up okToDeleteMoved.txt generated file.
Now force file generation into the test/data/generated directory where other
such files go so tests are cleaned up properly.
2014-07-23 12:59:13 +03:00
Robert Haines 9785b66a43 Update tests to use the minitest 5.x API.
MiniTest::Unit::TestCase -> MiniTest::Test
MiniTest::Unit.after_tests -> MiniTest.after_run
2014-07-23 12:59:13 +03:00
Alexander Simonov 2fcdc3a3ea Revert "Return created zip file from Zip::File.open when supplied a block"
This reverts commit e3029d0b10.
2014-07-02 18:15:54 +03:00
Tyler Pickett e3029d0b10 Return created zip file from Zip::File.open when supplied a block
This change is to match ruby zip’s behavior to core’s IO.open when
supplied a block.
2014-06-17 10:08:26 -06:00
Alexander Simonov 1173397321 Merge pull request #150 from iangreenleaf/tempfile_cleanup
Clean up tempfiles from output stream
2014-04-06 12:32:10 +03:00
Ian Young 37ed325783 Clean up tempfiles from output stream, fixes #57 2014-04-04 14:32:11 -07:00
Ian Young 3e28147525 Remove line doing random copy 2014-04-04 14:03:58 -07:00
Jeremy Stanley 9e144061b9 fix modifying existing zipfile with zip64 enabled
The local header size computed from the central directory entry
is incorrect due to the Zip64Placeholder in the local entry.
This caused us to seek to the wrong location when copying an
unchanged compressed data stream.

(The same problem could occur when modifying any zip file where
the local header and central directory header contain different
variable-sized fields, so it's a good idea not to trust the CD
to tell us the local header size in any case.)
2014-03-12 15:57:52 -06:00
Sam Rawlins a37e13c6f0 File.exists? -> File.exist? 2014-02-06 15:00:38 -08:00
Alexander Simonov ec81c30382 Fix for #126 and #127 2014-01-24 11:37:38 +02:00
Alexander Simonov 541ff9657f Move file generation to one folder 2014-01-20 23:42:27 +02:00
Alexander Simonov 58f08ca0e1 Split all tests to small files. Move to minitest 2014-01-20 23:31:06 +02:00