archive-zip 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/LICENSE +22 -57
  4. data/{NEWS → NEWS.md} +29 -16
  5. data/README.md +250 -0
  6. data/Rakefile +119 -76
  7. data/lib/archive/support/binary_stringio.rb +9 -2
  8. data/lib/archive/support/time.rb +2 -2
  9. data/lib/archive/zip.rb +1 -1
  10. data/lib/archive/zip/entry.rb +2 -2
  11. data/lib/archive/zip/version.rb +1 -1
  12. data/spec/archive/zip/archive_spec.rb +54 -0
  13. data/spec/archive/zip/codec/deflate/compress/checksum_spec.rb +8 -6
  14. data/spec/archive/zip/codec/deflate/compress/close_spec.rb +13 -12
  15. data/spec/archive/zip/codec/deflate/compress/crc32_spec.rb +6 -4
  16. data/spec/archive/zip/codec/deflate/compress/data_descriptor_spec.rb +17 -10
  17. data/spec/archive/zip/codec/deflate/compress/new_spec.rb +7 -5
  18. data/spec/archive/zip/codec/deflate/compress/open_spec.rb +9 -7
  19. data/spec/archive/zip/codec/deflate/compress/write_spec.rb +15 -15
  20. data/spec/archive/zip/codec/deflate/decompress/checksum_spec.rb +6 -4
  21. data/spec/archive/zip/codec/deflate/decompress/close_spec.rb +10 -9
  22. data/spec/archive/zip/codec/deflate/decompress/crc32_spec.rb +6 -4
  23. data/spec/archive/zip/codec/deflate/decompress/data_descriptor_spec.rb +17 -10
  24. data/spec/archive/zip/codec/deflate/decompress/new_spec.rb +5 -3
  25. data/spec/archive/zip/codec/deflate/decompress/open_spec.rb +7 -5
  26. data/spec/archive/zip/codec/null_encryption/decrypt/close_spec.rb +10 -9
  27. data/spec/archive/zip/codec/null_encryption/decrypt/new_spec.rb +6 -4
  28. data/spec/archive/zip/codec/null_encryption/decrypt/open_spec.rb +8 -6
  29. data/spec/archive/zip/codec/null_encryption/decrypt/read_spec.rb +8 -6
  30. data/spec/archive/zip/codec/null_encryption/decrypt/rewind_spec.rb +9 -7
  31. data/spec/archive/zip/codec/null_encryption/decrypt/seek_spec.rb +15 -13
  32. data/spec/archive/zip/codec/null_encryption/decrypt/tell_spec.rb +8 -6
  33. data/spec/archive/zip/codec/null_encryption/encrypt/close_spec.rb +10 -9
  34. data/spec/archive/zip/codec/null_encryption/encrypt/new_spec.rb +5 -3
  35. data/spec/archive/zip/codec/null_encryption/encrypt/open_spec.rb +9 -5
  36. data/spec/archive/zip/codec/null_encryption/encrypt/rewind_spec.rb +9 -7
  37. data/spec/archive/zip/codec/null_encryption/encrypt/seek_spec.rb +15 -13
  38. data/spec/archive/zip/codec/null_encryption/encrypt/tell_spec.rb +11 -9
  39. data/spec/archive/zip/codec/null_encryption/encrypt/write_spec.rb +12 -10
  40. data/spec/archive/zip/codec/store/compress/close_spec.rb +10 -9
  41. data/spec/archive/zip/codec/store/compress/data_descriptor_spec.rb +19 -10
  42. data/spec/archive/zip/codec/store/compress/new_spec.rb +5 -3
  43. data/spec/archive/zip/codec/store/compress/open_spec.rb +7 -5
  44. data/spec/archive/zip/codec/store/compress/rewind_spec.rb +9 -7
  45. data/spec/archive/zip/codec/store/compress/seek_spec.rb +15 -13
  46. data/spec/archive/zip/codec/store/compress/tell_spec.rb +11 -9
  47. data/spec/archive/zip/codec/store/compress/write_spec.rb +10 -10
  48. data/spec/archive/zip/codec/store/decompress/close_spec.rb +10 -9
  49. data/spec/archive/zip/codec/store/decompress/data_descriptor_spec.rb +17 -10
  50. data/spec/archive/zip/codec/store/decompress/new_spec.rb +5 -3
  51. data/spec/archive/zip/codec/store/decompress/open_spec.rb +7 -5
  52. data/spec/archive/zip/codec/store/decompress/read_spec.rb +8 -6
  53. data/spec/archive/zip/codec/store/decompress/rewind_spec.rb +9 -7
  54. data/spec/archive/zip/codec/store/decompress/seek_spec.rb +15 -13
  55. data/spec/archive/zip/codec/store/decompress/tell_spec.rb +8 -6
  56. data/spec/archive/zip/codec/traditional_encryption/decrypt/close_spec.rb +13 -24
  57. data/spec/archive/zip/codec/traditional_encryption/decrypt/new_spec.rb +6 -4
  58. data/spec/archive/zip/codec/traditional_encryption/decrypt/open_spec.rb +10 -6
  59. data/spec/archive/zip/codec/traditional_encryption/decrypt/read_spec.rb +12 -13
  60. data/spec/archive/zip/codec/traditional_encryption/decrypt/rewind_spec.rb +10 -12
  61. data/spec/archive/zip/codec/traditional_encryption/decrypt/seek_spec.rb +16 -18
  62. data/spec/archive/zip/codec/traditional_encryption/decrypt/tell_spec.rb +8 -6
  63. data/spec/archive/zip/codec/traditional_encryption/encrypt/close_spec.rb +13 -24
  64. data/spec/archive/zip/codec/traditional_encryption/encrypt/new_spec.rb +5 -3
  65. data/spec/archive/zip/codec/traditional_encryption/encrypt/open_spec.rb +7 -5
  66. data/spec/archive/zip/codec/traditional_encryption/encrypt/rewind_spec.rb +10 -12
  67. data/spec/archive/zip/codec/traditional_encryption/encrypt/seek_spec.rb +16 -18
  68. data/spec/archive/zip/codec/traditional_encryption/encrypt/tell_spec.rb +12 -14
  69. data/spec/archive/zip/codec/traditional_encryption/encrypt/write_spec.rb +8 -23
  70. data/spec/binary_stringio/new_spec.rb +18 -12
  71. data/spec/binary_stringio/set_encoding_spec.rb +10 -7
  72. data/spec/ioextensions/read_exactly_spec.rb +14 -12
  73. data/spec/zlib/zreader/checksum_spec.rb +10 -8
  74. data/spec/zlib/zreader/close_spec.rb +5 -3
  75. data/spec/zlib/zreader/compressed_size_spec.rb +6 -4
  76. data/spec/zlib/zreader/new_spec.rb +7 -5
  77. data/spec/zlib/zreader/open_spec.rb +9 -7
  78. data/spec/zlib/zreader/read_spec.rb +10 -8
  79. data/spec/zlib/zreader/rewind_spec.rb +7 -5
  80. data/spec/zlib/zreader/seek_spec.rb +13 -11
  81. data/spec/zlib/zreader/tell_spec.rb +8 -6
  82. data/spec/zlib/zreader/uncompressed_size_spec.rb +6 -4
  83. data/spec/zlib/zwriter/checksum_spec.rb +10 -8
  84. data/spec/zlib/zwriter/close_spec.rb +5 -3
  85. data/spec/zlib/zwriter/compressed_size_spec.rb +6 -4
  86. data/spec/zlib/zwriter/new_spec.rb +10 -8
  87. data/spec/zlib/zwriter/open_spec.rb +12 -10
  88. data/spec/zlib/zwriter/rewind_spec.rb +9 -7
  89. data/spec/zlib/zwriter/seek_spec.rb +15 -17
  90. data/spec/zlib/zwriter/tell_spec.rb +11 -9
  91. data/spec/zlib/zwriter/uncompressed_size_spec.rb +6 -4
  92. data/spec/zlib/zwriter/write_spec.rb +9 -9
  93. metadata +268 -217
  94. data/CONTRIBUTORS +0 -13
  95. data/GPL +0 -676
  96. data/HACKING +0 -105
  97. data/LEGAL +0 -8
  98. data/README +0 -151
  99. data/TODO +0 -5
  100. data/default.mspec +0 -8
  101. data/spec_helper.rb +0 -49
@@ -1,7 +1,9 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require File.dirname(__FILE__) + '/../../../../../../spec_helper'
4
- require File.dirname(__FILE__) + '/../fixtures/classes'
3
+ require 'minitest/autorun'
4
+
5
+ require File.expand_path('../../fixtures/classes', __FILE__)
6
+
5
7
  require 'archive/zip/codec/deflate'
6
8
  require 'archive/support/binary_stringio'
7
9
 
@@ -13,9 +15,9 @@ describe "Archive::Zip::Codec::Deflate::Compress#crc32" do
13
15
  ) do |compressor|
14
16
  compressor.write(DeflateSpecs.test_data)
15
17
  compressor.flush
16
- compressor.crc32.should == Zlib.crc32(DeflateSpecs.test_data)
18
+ compressor.crc32.must_equal Zlib.crc32(DeflateSpecs.test_data)
17
19
  compressor
18
20
  end
19
- closed_compressor.crc32.should == Zlib.crc32(DeflateSpecs.test_data)
21
+ closed_compressor.crc32.must_equal Zlib.crc32(DeflateSpecs.test_data)
20
22
  end
21
23
  end
@@ -1,7 +1,9 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require File.dirname(__FILE__) + '/../../../../../../spec_helper'
4
- require File.dirname(__FILE__) + '/../fixtures/classes'
3
+ require 'minitest/autorun'
4
+
5
+ require File.expand_path('../../fixtures/classes', __FILE__)
6
+
5
7
  require 'archive/zip/codec/deflate'
6
8
  require 'archive/support/binary_stringio'
7
9
 
@@ -14,11 +16,12 @@ describe "Archive::Zip::Codec::Deflate::Compress#data_descriptor" do
14
16
  ) do |compressor|
15
17
  compressor.write(test_data)
16
18
  compressor.flush
17
- compressor.data_descriptor.class.should == Archive::Zip::DataDescriptor
19
+ compressor.data_descriptor.class.must_equal(Archive::Zip::DataDescriptor)
18
20
  compressor
19
21
  end
20
- closed_compressor.data_descriptor.class.should ==
22
+ closed_compressor.data_descriptor.class.must_equal(
21
23
  Archive::Zip::DataDescriptor
24
+ )
22
25
  end
23
26
 
24
27
  it "has a crc32 attribute containing the CRC32 checksum" do
@@ -29,10 +32,10 @@ describe "Archive::Zip::Codec::Deflate::Compress#data_descriptor" do
29
32
  ) do |compressor|
30
33
  compressor.write(test_data)
31
34
  compressor.flush
32
- compressor.data_descriptor.crc32.should == Zlib.crc32(test_data)
35
+ compressor.data_descriptor.crc32.must_equal(Zlib.crc32(test_data))
33
36
  compressor
34
37
  end
35
- closed_compressor.data_descriptor.crc32.should == Zlib.crc32(test_data)
38
+ closed_compressor.data_descriptor.crc32.must_equal(Zlib.crc32(test_data))
36
39
  end
37
40
 
38
41
  it "has a compressed_size attribute containing the size of the compressed data" do
@@ -43,12 +46,14 @@ describe "Archive::Zip::Codec::Deflate::Compress#data_descriptor" do
43
46
  ) do |compressor|
44
47
  compressor.write(test_data)
45
48
  compressor.flush
46
- compressor.data_descriptor.compressed_size.should ==
49
+ compressor.data_descriptor.compressed_size.must_equal(
47
50
  compressed_data.size
51
+ )
48
52
  compressor
49
53
  end
50
- closed_compressor.data_descriptor.compressed_size.should ==
54
+ closed_compressor.data_descriptor.compressed_size.must_equal(
51
55
  compressed_data.size
56
+ )
52
57
  end
53
58
 
54
59
  it "has an uncompressed_size attribute containing the size of the input data" do
@@ -59,9 +64,11 @@ describe "Archive::Zip::Codec::Deflate::Compress#data_descriptor" do
59
64
  ) do |compressor|
60
65
  compressor.write(test_data)
61
66
  compressor.flush
62
- compressor.data_descriptor.uncompressed_size.should == test_data.size
67
+ compressor.data_descriptor.uncompressed_size.must_equal(test_data.size)
63
68
  compressor
64
69
  end
65
- closed_compressor.data_descriptor.uncompressed_size.should == test_data.size
70
+ closed_compressor.data_descriptor.uncompressed_size.must_equal(
71
+ test_data.size
72
+ )
66
73
  end
67
74
  end
@@ -1,7 +1,9 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require File.dirname(__FILE__) + '/../../../../../../spec_helper'
4
- require File.dirname(__FILE__) + '/../fixtures/classes'
3
+ require 'minitest/autorun'
4
+
5
+ require File.expand_path('../../fixtures/classes', __FILE__)
6
+
5
7
  require 'archive/zip/codec/deflate'
6
8
  require 'archive/support/binary_stringio'
7
9
 
@@ -10,7 +12,7 @@ describe "Archive::Zip::Codec::Deflate::Compress.new" do
10
12
  c = Archive::Zip::Codec::Deflate::Compress.new(
11
13
  BinaryStringIO.new, Zlib::DEFAULT_COMPRESSION
12
14
  )
13
- c.class.should == Archive::Zip::Codec::Deflate::Compress
15
+ c.must_be_instance_of(Archive::Zip::Codec::Deflate::Compress)
14
16
  c.close
15
17
  end
16
18
 
@@ -23,7 +25,7 @@ describe "Archive::Zip::Codec::Deflate::Compress.new" do
23
25
  c.write(data)
24
26
  c.close
25
27
 
26
- compressed_data.string.should == DeflateSpecs.compressed_data
28
+ compressed_data.string.must_equal(DeflateSpecs.compressed_data)
27
29
 
28
30
  compressed_data = BinaryStringIO.new
29
31
  c = Archive::Zip::Codec::Deflate::Compress.new(
@@ -32,6 +34,6 @@ describe "Archive::Zip::Codec::Deflate::Compress.new" do
32
34
  c.write(data)
33
35
  c.close
34
36
 
35
- compressed_data.string.should == DeflateSpecs.compressed_data_nocomp
37
+ compressed_data.string.must_equal(DeflateSpecs.compressed_data_nocomp)
36
38
  end
37
39
  end
@@ -1,7 +1,9 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require File.dirname(__FILE__) + '/../../../../../../spec_helper'
4
- require File.dirname(__FILE__) + '/../fixtures/classes'
3
+ require 'minitest/autorun'
4
+
5
+ require File.expand_path('../../fixtures/classes', __FILE__)
6
+
5
7
  require 'archive/zip/codec/deflate'
6
8
  require 'archive/support/binary_stringio'
7
9
 
@@ -10,20 +12,20 @@ describe "Archive::Zip::Codec::Deflate::Compress.open" do
10
12
  c = Archive::Zip::Codec::Deflate::Compress.open(
11
13
  BinaryStringIO.new, Zlib::DEFAULT_COMPRESSION
12
14
  )
13
- c.class.should == Archive::Zip::Codec::Deflate::Compress
15
+ c.must_be_instance_of(Archive::Zip::Codec::Deflate::Compress)
14
16
  c.close
15
17
  end
16
18
 
17
19
  it "executes a block with a new instance as an argument" do
18
20
  Archive::Zip::Codec::Deflate::Compress.open(
19
21
  BinaryStringIO.new, Zlib::DEFAULT_COMPRESSION
20
- ) { |c| c.class.should == Archive::Zip::Codec::Deflate::Compress }
22
+ ) { |c| c.must_be_instance_of(Archive::Zip::Codec::Deflate::Compress) }
21
23
  end
22
24
 
23
25
  it "closes the object after executing a block" do
24
26
  Archive::Zip::Codec::Deflate::Compress.open(
25
27
  BinaryStringIO.new, Zlib::DEFAULT_COMPRESSION
26
- ) { |c| c }.closed?.should.be_true
28
+ ) { |c| c }.closed?.must_equal(true)
27
29
  end
28
30
 
29
31
  it "allows level to be set" do
@@ -33,7 +35,7 @@ describe "Archive::Zip::Codec::Deflate::Compress.open" do
33
35
  compressed_data, Zlib::DEFAULT_COMPRESSION
34
36
  ) { |c| c.write(data) }
35
37
 
36
- compressed_data.string.should == DeflateSpecs.compressed_data
38
+ compressed_data.string.must_equal(DeflateSpecs.compressed_data)
37
39
 
38
40
  data = DeflateSpecs.test_data
39
41
  compressed_data = BinaryStringIO.new
@@ -41,6 +43,6 @@ describe "Archive::Zip::Codec::Deflate::Compress.open" do
41
43
  compressed_data, Zlib::NO_COMPRESSION
42
44
  ) { |c| c.write(data) }
43
45
 
44
- compressed_data.string.should == DeflateSpecs.compressed_data_nocomp
46
+ compressed_data.string.must_equal(DeflateSpecs.compressed_data_nocomp)
45
47
  end
46
48
  end
@@ -1,19 +1,19 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require File.dirname(__FILE__) + '/../../../../../../spec_helper'
4
- require File.dirname(__FILE__) + '/../fixtures/classes'
3
+ require 'minitest/autorun'
4
+
5
+ require File.expand_path('../../fixtures/classes', __FILE__)
6
+
5
7
  require 'archive/zip/codec/deflate'
6
8
  require 'archive/support/binary_stringio'
7
9
 
8
10
  describe "Archive::Zip::Codec::Deflate::Compress#write" do
9
11
  it "calls the write method of the delegate" do
10
- delegate = mock('delegate')
11
- # RSpec's mocking facility supposedly supports this, but MSpec's does not as
12
- # of version 1.5.10.
13
- #delegate.should_receive(:write).with(an_instance_of(String)).at_least(:once).and_return { |s| s.length }
14
- # Use the following instead for now.
15
- delegate.should_receive(:write).at_least(:once).and_return(1)
16
- delegate.should_receive(:close).once.and_return(nil)
12
+ delegate = MiniTest::Mock.new
13
+ delegate.expect(
14
+ :write, DeflateSpecs.compressed_data.size, [DeflateSpecs.compressed_data]
15
+ )
16
+ delegate.expect(:close, nil)
17
17
  Archive::Zip::Codec::Deflate::Compress.open(
18
18
  delegate, Zlib::DEFAULT_COMPRESSION
19
19
  ) do |compressor|
@@ -28,7 +28,7 @@ describe "Archive::Zip::Codec::Deflate::Compress#write" do
28
28
  ) do |compressor|
29
29
  compressor.write(DeflateSpecs.test_data)
30
30
  end
31
- compressed_data.string.should == DeflateSpecs.compressed_data
31
+ compressed_data.string.must_equal(DeflateSpecs.compressed_data)
32
32
  end
33
33
 
34
34
  it "writes compressed data to a delegate that only performs partial writes" do
@@ -46,13 +46,13 @@ describe "Archive::Zip::Codec::Deflate::Compress#write" do
46
46
  ) do |compressor|
47
47
  compressor.write(DeflateSpecs.test_data)
48
48
  end
49
- compressed_data.string.should == DeflateSpecs.compressed_data
49
+ compressed_data.string.must_equal(DeflateSpecs.compressed_data)
50
50
  end
51
51
 
52
52
  it "writes compressed data to a delegate that raises Errno::EAGAIN" do
53
53
  compressed_data = BinaryStringIO.new
54
- # Override compressed_data.write to raise Errno::EAGAIN every other time it's
55
- # called.
54
+ # Override compressed_data.write to raise Errno::EAGAIN every other time
55
+ # it's called.
56
56
  class << compressed_data
57
57
  alias :write_orig :write
58
58
  def write(buffer)
@@ -75,7 +75,7 @@ describe "Archive::Zip::Codec::Deflate::Compress#write" do
75
75
  retry
76
76
  end
77
77
  end
78
- compressed_data.string.should == DeflateSpecs.compressed_data
78
+ compressed_data.string.must_equal(DeflateSpecs.compressed_data)
79
79
  end
80
80
 
81
81
  it "writes compressed data to a delegate that raises Errno::EINTR" do
@@ -104,6 +104,6 @@ describe "Archive::Zip::Codec::Deflate::Compress#write" do
104
104
  retry
105
105
  end
106
106
  end
107
- compressed_data.string.should == DeflateSpecs.compressed_data
107
+ compressed_data.string.must_equal(DeflateSpecs.compressed_data)
108
108
  end
109
109
  end
@@ -1,7 +1,9 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require File.dirname(__FILE__) + '/../../../../../../spec_helper'
4
- require File.dirname(__FILE__) + '/../fixtures/classes'
3
+ require 'minitest/autorun'
4
+
5
+ require File.expand_path('../../fixtures/classes', __FILE__)
6
+
5
7
  require 'archive/zip/codec/deflate'
6
8
 
7
9
  describe "Archive::Zip::Deflate::Decompress#checksum" do
@@ -9,10 +11,10 @@ describe "Archive::Zip::Deflate::Decompress#checksum" do
9
11
  closed_decompressor = DeflateSpecs.compressed_data do |f|
10
12
  Archive::Zip::Codec::Deflate::Decompress.open(f) do |decompressor|
11
13
  decompressor.read
12
- decompressor.checksum.should == Zlib.crc32(DeflateSpecs.test_data)
14
+ decompressor.checksum.must_equal(Zlib.crc32(DeflateSpecs.test_data))
13
15
  decompressor
14
16
  end
15
17
  end
16
- closed_decompressor.checksum.should == Zlib.crc32(DeflateSpecs.test_data)
18
+ closed_decompressor.checksum.must_equal(Zlib.crc32(DeflateSpecs.test_data))
17
19
  end
18
20
  end
@@ -1,7 +1,9 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require File.dirname(__FILE__) + '/../../../../../../spec_helper'
4
- require File.dirname(__FILE__) + '/../fixtures/classes'
3
+ require 'minitest/autorun'
4
+
5
+ require File.expand_path('../../fixtures/classes', __FILE__)
6
+
5
7
  require 'archive/zip/codec/deflate'
6
8
  require 'archive/support/binary_stringio'
7
9
 
@@ -9,24 +11,23 @@ describe "Archive::Zip::Codec::Deflate::Decompress#close" do
9
11
  it "closes the stream" do
10
12
  c = Archive::Zip::Codec::Deflate::Decompress.new(BinaryStringIO.new)
11
13
  c.close
12
- c.closed?.should be_true
14
+ c.closed?.must_equal(true)
13
15
  end
14
16
 
15
17
  it "closes the delegate stream by default" do
16
- delegate = mock('delegate')
17
- delegate.should_receive(:close).and_return(nil)
18
+ delegate = MiniTest::Mock.new
19
+ delegate.expect(:close, nil)
18
20
  c = Archive::Zip::Codec::Deflate::Decompress.new(delegate)
19
21
  c.close
20
22
  end
21
23
 
22
24
  it "optionally leaves the delegate stream open" do
23
- delegate = mock('delegate')
24
- delegate.should_receive(:close).and_return(nil)
25
+ delegate = MiniTest::Mock.new
26
+ delegate.expect(:close, nil)
25
27
  c = Archive::Zip::Codec::Deflate::Decompress.new(delegate)
26
28
  c.close(true)
27
29
 
28
- delegate = mock('delegate')
29
- delegate.should_not_receive(:close)
30
+ delegate = MiniTest::Mock.new
30
31
  c = Archive::Zip::Codec::Deflate::Decompress.new(delegate)
31
32
  c.close(false)
32
33
  end
@@ -1,7 +1,9 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require File.dirname(__FILE__) + '/../../../../../../spec_helper'
4
- require File.dirname(__FILE__) + '/../fixtures/classes'
3
+ require 'minitest/autorun'
4
+
5
+ require File.expand_path('../../fixtures/classes', __FILE__)
6
+
5
7
  require 'archive/zip/codec/deflate'
6
8
 
7
9
  describe "Archive::Zip::Deflate::Decompress#crc32" do
@@ -9,10 +11,10 @@ describe "Archive::Zip::Deflate::Decompress#crc32" do
9
11
  closed_decompressor = DeflateSpecs.compressed_data do |f|
10
12
  Archive::Zip::Codec::Deflate::Decompress.open(f) do |decompressor|
11
13
  decompressor.read
12
- decompressor.crc32.should == Zlib.crc32(DeflateSpecs.test_data)
14
+ decompressor.crc32.must_equal(Zlib.crc32(DeflateSpecs.test_data))
13
15
  decompressor
14
16
  end
15
17
  end
16
- closed_decompressor.crc32.should == Zlib.crc32(DeflateSpecs.test_data)
18
+ closed_decompressor.crc32.must_equal(Zlib.crc32(DeflateSpecs.test_data))
17
19
  end
18
20
  end
@@ -1,7 +1,9 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require File.dirname(__FILE__) + '/../../../../../../spec_helper'
4
- require File.dirname(__FILE__) + '/../fixtures/classes'
3
+ require 'minitest/autorun'
4
+
5
+ require File.expand_path('../../fixtures/classes', __FILE__)
6
+
5
7
  require 'archive/zip/codec/deflate'
6
8
 
7
9
  describe "Archive::Zip::Codec::Deflate::Decompress#data_descriptor" do
@@ -11,12 +13,14 @@ describe "Archive::Zip::Codec::Deflate::Decompress#data_descriptor" do
11
13
  cd
12
14
  ) do |decompressor|
13
15
  decompressor.read
14
- decompressor.data_descriptor.class.should ==
16
+ decompressor.data_descriptor.must_be_instance_of(
15
17
  Archive::Zip::DataDescriptor
18
+ )
16
19
  decompressor
17
20
  end
18
- closed_decompressor.data_descriptor.class.should ==
21
+ closed_decompressor.data_descriptor.must_be_instance_of(
19
22
  Archive::Zip::DataDescriptor
23
+ )
20
24
  end
21
25
  end
22
26
 
@@ -27,10 +31,10 @@ describe "Archive::Zip::Codec::Deflate::Decompress#data_descriptor" do
27
31
  cd
28
32
  ) do |decompressor|
29
33
  decompressor.read
30
- decompressor.data_descriptor.crc32.should == crc32
34
+ decompressor.data_descriptor.crc32.must_equal(crc32)
31
35
  decompressor
32
36
  end
33
- closed_decompressor.data_descriptor.crc32.should == crc32
37
+ closed_decompressor.data_descriptor.crc32.must_equal(crc32)
34
38
  end
35
39
  end
36
40
 
@@ -41,11 +45,12 @@ describe "Archive::Zip::Codec::Deflate::Decompress#data_descriptor" do
41
45
  cd
42
46
  ) do |decompressor|
43
47
  decompressor.read
44
- decompressor.data_descriptor.compressed_size.should == compressed_size
48
+ decompressor.data_descriptor.compressed_size.must_equal(compressed_size)
45
49
  decompressor
46
50
  end
47
- closed_decompressor.data_descriptor.compressed_size.should ==
51
+ closed_decompressor.data_descriptor.compressed_size.must_equal(
48
52
  compressed_size
53
+ )
49
54
  end
50
55
  end
51
56
 
@@ -56,12 +61,14 @@ describe "Archive::Zip::Codec::Deflate::Decompress#data_descriptor" do
56
61
  cd
57
62
  ) do |decompressor|
58
63
  decompressor.read
59
- decompressor.data_descriptor.uncompressed_size.should ==
64
+ decompressor.data_descriptor.uncompressed_size.must_equal(
60
65
  uncompressed_size
66
+ )
61
67
  decompressor
62
68
  end
63
- closed_decompressor.data_descriptor.uncompressed_size.should ==
69
+ closed_decompressor.data_descriptor.uncompressed_size.must_equal(
64
70
  uncompressed_size
71
+ )
65
72
  end
66
73
  end
67
74
  end
@@ -1,14 +1,16 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require File.dirname(__FILE__) + '/../../../../../../spec_helper'
4
- require File.dirname(__FILE__) + '/../fixtures/classes'
3
+ require 'minitest/autorun'
4
+
5
+ require File.expand_path('../../fixtures/classes', __FILE__)
6
+
5
7
  require 'archive/zip/codec/deflate'
6
8
  require 'archive/support/binary_stringio'
7
9
 
8
10
  describe "Archive::Zip::Codec::Deflate::Decompress.new" do
9
11
  it "returns a new instance" do
10
12
  d = Archive::Zip::Codec::Deflate::Decompress.new(BinaryStringIO.new)
11
- d.class.should == Archive::Zip::Codec::Deflate::Decompress
13
+ d.must_be_instance_of(Archive::Zip::Codec::Deflate::Decompress)
12
14
  d.close
13
15
  end
14
16
  end
@@ -1,20 +1,22 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require File.dirname(__FILE__) + '/../../../../../../spec_helper'
4
- require File.dirname(__FILE__) + '/../fixtures/classes'
3
+ require 'minitest/autorun'
4
+
5
+ require File.expand_path('../../fixtures/classes', __FILE__)
6
+
5
7
  require 'archive/zip/codec/deflate'
6
8
  require 'archive/support/binary_stringio'
7
9
 
8
10
  describe "Archive::Zip::Codec::Deflate::Decompress.open" do
9
11
  it "returns a new instance when run without a block" do
10
12
  d = Archive::Zip::Codec::Deflate::Decompress.open(BinaryStringIO.new)
11
- d.class.should == Archive::Zip::Codec::Deflate::Decompress
13
+ d.must_be_instance_of(Archive::Zip::Codec::Deflate::Decompress)
12
14
  d.close
13
15
  end
14
16
 
15
17
  it "executes a block with a new instance as an argument" do
16
18
  Archive::Zip::Codec::Deflate::Decompress.open(BinaryStringIO.new) do |decompressor|
17
- decompressor.class.should == Archive::Zip::Codec::Deflate::Decompress
19
+ decompressor.must_be_instance_of(Archive::Zip::Codec::Deflate::Decompress)
18
20
  end
19
21
  end
20
22
 
@@ -22,6 +24,6 @@ describe "Archive::Zip::Codec::Deflate::Decompress.open" do
22
24
  d = Archive::Zip::Codec::Deflate::Decompress.open(BinaryStringIO.new) do |decompressor|
23
25
  decompressor
24
26
  end
25
- d.closed?.should.be_true
27
+ d.closed?.must_equal(true)
26
28
  end
27
29
  end