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/support/zlib'
6
8
  require 'archive/zip/codec/store'
7
9
 
@@ -12,12 +14,14 @@ describe "Archive::Zip::Codec::Store::Decompress#data_descriptor" do
12
14
  cd
13
15
  ) do |decompressor|
14
16
  decompressor.read
15
- decompressor.data_descriptor.class.should ==
17
+ decompressor.data_descriptor.must_be_instance_of(
16
18
  Archive::Zip::DataDescriptor
19
+ )
17
20
  decompressor
18
21
  end
19
- closed_decompressor.data_descriptor.class.should ==
22
+ closed_decompressor.data_descriptor.must_be_instance_of(
20
23
  Archive::Zip::DataDescriptor
24
+ )
21
25
  end
22
26
  end
23
27
 
@@ -28,10 +32,10 @@ describe "Archive::Zip::Codec::Store::Decompress#data_descriptor" do
28
32
  cd
29
33
  ) do |decompressor|
30
34
  decompressor.read
31
- decompressor.data_descriptor.crc32.should == crc32
35
+ decompressor.data_descriptor.crc32.must_equal(crc32)
32
36
  decompressor
33
37
  end
34
- closed_decompressor.data_descriptor.crc32.should == crc32
38
+ closed_decompressor.data_descriptor.crc32.must_equal(crc32)
35
39
  end
36
40
  end
37
41
 
@@ -42,11 +46,12 @@ describe "Archive::Zip::Codec::Store::Decompress#data_descriptor" do
42
46
  cd
43
47
  ) do |decompressor|
44
48
  decompressor.read
45
- decompressor.data_descriptor.compressed_size.should == compressed_size
49
+ decompressor.data_descriptor.compressed_size.must_equal(compressed_size)
46
50
  decompressor
47
51
  end
48
- closed_decompressor.data_descriptor.compressed_size.should ==
52
+ closed_decompressor.data_descriptor.compressed_size.must_equal(
49
53
  compressed_size
54
+ )
50
55
  end
51
56
  end
52
57
 
@@ -57,12 +62,14 @@ describe "Archive::Zip::Codec::Store::Decompress#data_descriptor" do
57
62
  cd
58
63
  ) do |decompressor|
59
64
  decompressor.read
60
- decompressor.data_descriptor.uncompressed_size.should ==
65
+ decompressor.data_descriptor.uncompressed_size.must_equal(
61
66
  uncompressed_size
67
+ )
62
68
  decompressor
63
69
  end
64
- closed_decompressor.data_descriptor.uncompressed_size.should ==
70
+ closed_decompressor.data_descriptor.uncompressed_size.must_equal(
65
71
  uncompressed_size
72
+ )
66
73
  end
67
74
  end
68
75
  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/store'
6
8
  require 'archive/support/binary_stringio'
7
9
 
8
10
  describe "Archive::Zip::Codec::Store::Decompress.new" do
9
11
  it "returns a new instance" do
10
12
  d = Archive::Zip::Codec::Store::Decompress.new(BinaryStringIO.new)
11
- d.class.should == Archive::Zip::Codec::Store::Decompress
13
+ d.must_be_instance_of(Archive::Zip::Codec::Store::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/store'
6
8
  require 'archive/support/binary_stringio'
7
9
 
8
10
  describe "Archive::Zip::Codec::Store::Decompress.open" do
9
11
  it "returns a new instance when run without a block" do
10
12
  d = Archive::Zip::Codec::Store::Decompress.open(BinaryStringIO.new)
11
- d.class.should == Archive::Zip::Codec::Store::Decompress
13
+ d.must_be_instance_of(Archive::Zip::Codec::Store::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::Store::Decompress.open(BinaryStringIO.new) do |decompressor|
17
- decompressor.class.should == Archive::Zip::Codec::Store::Decompress
19
+ decompressor.must_be_instance_of(Archive::Zip::Codec::Store::Decompress)
18
20
  end
19
21
  end
20
22
 
@@ -22,6 +24,6 @@ describe "Archive::Zip::Codec::Store::Decompress.open" do
22
24
  d = Archive::Zip::Codec::Store::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
@@ -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/store'
6
8
 
7
9
  describe "Archive::Zip::Codec::Store::Decompress#read" do
8
10
  it "calls the read method of the delegate" do
9
- delegate = mock('delegate')
10
- delegate.should_receive(:read).and_return(nil)
11
- delegate.should_receive(:close).and_return(nil)
11
+ delegate = MiniTest::Mock.new
12
+ delegate.expect(:read, nil, [Integer])
13
+ delegate.expect(:close, nil)
12
14
  Archive::Zip::Codec::Store::Decompress.open(delegate) do |d|
13
15
  d.read
14
16
  end
@@ -17,7 +19,7 @@ describe "Archive::Zip::Codec::Store::Decompress#read" do
17
19
  it "passes data through unmodified" do
18
20
  StoreSpecs.compressed_data do |cd|
19
21
  Archive::Zip::Codec::Store::Decompress.open(cd) do |d|
20
- d.read.should == StoreSpecs.test_data
22
+ d.read.must_equal(StoreSpecs.test_data)
21
23
  end
22
24
  end
23
25
  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/store'
6
8
 
7
9
  describe "Archive::Zip::Codec::Store::Decompress#rewind" do
@@ -9,17 +11,17 @@ describe "Archive::Zip::Codec::Store::Decompress#rewind" do
9
11
  StoreSpecs.compressed_data do |cd|
10
12
  Archive::Zip::Codec::Store::Decompress.open(cd) do |d|
11
13
  d.read(4)
12
- lambda { d.rewind }.should_not raise_error
13
- d.read.should == StoreSpecs.test_data
14
+ d.rewind
15
+ d.read.must_equal(StoreSpecs.test_data)
14
16
  end
15
17
  end
16
18
  end
17
19
 
18
20
  it "raises Errno::EINVAL when attempting to rewind the stream when the delegate does not respond to rewind" do
19
- delegate = mock('delegate')
20
- delegate.should_receive(:close).and_return(nil)
21
+ delegate = MiniTest::Mock.new
22
+ delegate.expect(:close, nil)
21
23
  Archive::Zip::Codec::Store::Decompress.open(delegate) do |d|
22
- lambda { d.rewind }.should raise_error(Errno::EINVAL)
24
+ lambda { d.rewind }.must_raise(Errno::EINVAL)
23
25
  end
24
26
  end
25
27
  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/store'
6
8
 
7
9
  describe "Archive::Zip::Codec::Store::Decompress#seek" do
@@ -9,16 +11,16 @@ describe "Archive::Zip::Codec::Store::Decompress#seek" do
9
11
  StoreSpecs.compressed_data do |cd|
10
12
  Archive::Zip::Codec::Store::Decompress.open(cd) do |d|
11
13
  d.read(4)
12
- lambda { d.seek(0) }.should_not raise_error
14
+ d.seek(0).must_equal(0)
13
15
  end
14
16
  end
15
17
  end
16
18
 
17
19
  it "raises Errno::EINVAL when attempting to seek to the beginning of the stream when the delegate does not respond to rewind" do
18
- delegate = mock('delegate')
19
- delegate.should_receive(:close).and_return(nil)
20
+ delegate = MiniTest::Mock.new
21
+ delegate.expect(:close, nil)
20
22
  Archive::Zip::Codec::Store::Decompress.open(delegate) do |d|
21
- lambda { d.seek(0) }.should raise_error(Errno::EINVAL)
23
+ lambda { d.seek(0) }.must_raise(Errno::EINVAL)
22
24
  end
23
25
  end
24
26
 
@@ -30,8 +32,8 @@ describe "Archive::Zip::Codec::Store::Decompress#seek" do
30
32
  d.fill_size = 0
31
33
 
32
34
  d.read(4)
33
- lambda { d.seek(1, IO::SEEK_CUR) }.should raise_error(Errno::EINVAL)
34
- lambda { d.seek(-1, IO::SEEK_CUR) }.should raise_error(Errno::EINVAL)
35
+ lambda { d.seek(1, IO::SEEK_CUR) }.must_raise(Errno::EINVAL)
36
+ lambda { d.seek(-1, IO::SEEK_CUR) }.must_raise(Errno::EINVAL)
35
37
  end
36
38
  end
37
39
  end
@@ -39,8 +41,8 @@ describe "Archive::Zip::Codec::Store::Decompress#seek" do
39
41
  it "raises Errno::EINVAL when seeking a non-zero offset relative to the beginning of the stream" do
40
42
  StoreSpecs.compressed_data do |cd|
41
43
  Archive::Zip::Codec::Store::Decompress.open(cd) do |d|
42
- lambda { d.seek(-1, IO::SEEK_SET) }.should raise_error(Errno::EINVAL)
43
- lambda { d.seek(1, IO::SEEK_SET) }.should raise_error(Errno::EINVAL)
44
+ lambda { d.seek(-1, IO::SEEK_SET) }.must_raise(Errno::EINVAL)
45
+ lambda { d.seek(1, IO::SEEK_SET) }.must_raise(Errno::EINVAL)
44
46
  end
45
47
  end
46
48
  end
@@ -48,9 +50,9 @@ describe "Archive::Zip::Codec::Store::Decompress#seek" do
48
50
  it "raises Errno::EINVAL when seeking relative to the end of the stream" do
49
51
  StoreSpecs.compressed_data do |cd|
50
52
  Archive::Zip::Codec::Store::Decompress.open(cd) do |d|
51
- lambda { d.seek(0, IO::SEEK_END) }.should raise_error(Errno::EINVAL)
52
- lambda { d.seek(-1, IO::SEEK_END) }.should raise_error(Errno::EINVAL)
53
- lambda { d.seek(1, IO::SEEK_END) }.should raise_error(Errno::EINVAL)
53
+ lambda { d.seek(0, IO::SEEK_END) }.must_raise(Errno::EINVAL)
54
+ lambda { d.seek(-1, IO::SEEK_END) }.must_raise(Errno::EINVAL)
55
+ lambda { d.seek(1, IO::SEEK_END) }.must_raise(Errno::EINVAL)
54
56
  end
55
57
  end
56
58
  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/store'
6
8
 
7
9
  describe "Archive::Zip::Codec::Store::Decompress#tell" do
8
10
  it "returns the current position of the stream" do
9
11
  StoreSpecs.compressed_data do |cd|
10
12
  Archive::Zip::Codec::Store::Decompress.open(cd) do |d|
11
- d.tell.should == 0
13
+ d.tell.must_equal(0)
12
14
  d.read(4)
13
- d.tell.should == 4
15
+ d.tell.must_equal(4)
14
16
  d.read
15
- d.tell.should == 235
17
+ d.tell.must_equal(235)
16
18
  d.rewind
17
- d.tell.should == 0
19
+ d.tell.must_equal(0)
18
20
  end
19
21
  end
20
22
  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/traditional_encryption'
6
8
  require 'archive/support/binary_stringio'
7
9
 
@@ -13,17 +15,13 @@ describe "Archive::Zip::Codec::TraditionalEncryption::Decrypt#close" do
13
15
  TraditionalEncryptionSpecs.mtime
14
16
  )
15
17
  d.close
16
- d.closed?.should be_true
18
+ d.closed?.must_equal(true)
17
19
  end
18
20
 
19
21
  it "closes the delegate stream by default" do
20
- delegate = mock('delegate')
21
- # RSpec's mocking facility supposedly supports this, but MSpec's does not as
22
- # of version 1.5.10.
23
- #delegate.should_receive(:read).with(an_instance_of(Fixnum)).at_least(:once).and_return { |n| "\000" * n }
24
- # Use the following instead for now.
25
- delegate.should_receive(:read).once.and_return("\000" * 12)
26
- delegate.should_receive(:close).and_return(nil)
22
+ delegate = MiniTest::Mock.new
23
+ delegate.expect(:read, "\000" * 12, [Integer])
24
+ delegate.expect(:close, nil)
27
25
  d = Archive::Zip::Codec::TraditionalEncryption::Decrypt.new(
28
26
  delegate,
29
27
  TraditionalEncryptionSpecs.password,
@@ -33,13 +31,9 @@ describe "Archive::Zip::Codec::TraditionalEncryption::Decrypt#close" do
33
31
  end
34
32
 
35
33
  it "optionally leaves the delegate stream open" do
36
- delegate = mock('delegate')
37
- # RSpec's mocking facility supposedly supports this, but MSpec's does not as
38
- # of version 1.5.10.
39
- #delegate.should_receive(:read).with(an_instance_of(Fixnum)).at_least(:once).and_return { |n| "\000" * n }
40
- # Use the following instead for now.
41
- delegate.should_receive(:read).once.and_return("\000" * 12)
42
- delegate.should_receive(:close).and_return(nil)
34
+ delegate = MiniTest::Mock.new
35
+ delegate.expect(:read, "\000" * 12, [Integer])
36
+ delegate.expect(:close, nil)
43
37
  d = Archive::Zip::Codec::TraditionalEncryption::Decrypt.new(
44
38
  delegate,
45
39
  TraditionalEncryptionSpecs.password,
@@ -47,13 +41,8 @@ describe "Archive::Zip::Codec::TraditionalEncryption::Decrypt#close" do
47
41
  )
48
42
  d.close(true)
49
43
 
50
- delegate = mock('delegate')
51
- # RSpec's mocking facility supposedly supports this, but MSpec's does not as
52
- # of version 1.5.10.
53
- #delegate.should_receive(:read).with(an_instance_of(Fixnum)).at_least(:once).and_return { |n| "\000" * n }
54
- # Use the following instead for now.
55
- delegate.should_receive(:read).once.and_return("\000" * 12)
56
- delegate.should_not_receive(:close)
44
+ delegate = MiniTest::Mock.new
45
+ delegate.expect(:read, "\000" * 12, [Integer])
57
46
  d = Archive::Zip::Codec::TraditionalEncryption::Decrypt.new(
58
47
  delegate,
59
48
  TraditionalEncryptionSpecs.password,
@@ -1,8 +1,10 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require File.dirname(__FILE__) + '/../../../../../../spec_helper'
4
- require File.dirname(__FILE__) + '/../fixtures/classes'
5
- require 'archive/zip/codec/store'
3
+ require 'minitest/autorun'
4
+
5
+ require File.expand_path('../../fixtures/classes', __FILE__)
6
+
7
+ require 'archive/zip/codec/traditional_encryption'
6
8
  require 'archive/support/binary_stringio'
7
9
 
8
10
  describe "Archive::Zip::Codec::TraditionalEncryption::Decrypt.new" do
@@ -12,7 +14,7 @@ describe "Archive::Zip::Codec::TraditionalEncryption::Decrypt.new" do
12
14
  TraditionalEncryptionSpecs.password,
13
15
  TraditionalEncryptionSpecs.mtime
14
16
  )
15
- d.class.should == Archive::Zip::Codec::TraditionalEncryption::Decrypt
17
+ d.must_be_instance_of(Archive::Zip::Codec::TraditionalEncryption::Decrypt)
16
18
  d.close
17
19
  end
18
20
  end
@@ -1,8 +1,10 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require File.dirname(__FILE__) + '/../../../../../../spec_helper'
4
- require File.dirname(__FILE__) + '/../fixtures/classes'
5
- require 'archive/zip/codec/store'
3
+ require 'minitest/autorun'
4
+
5
+ require File.expand_path('../../fixtures/classes', __FILE__)
6
+
7
+ require 'archive/zip/codec/traditional_encryption'
6
8
  require 'archive/support/binary_stringio'
7
9
 
8
10
  describe "Archive::Zip::Codec::TraditionalEncryption::Decrypt.open" do
@@ -12,7 +14,7 @@ describe "Archive::Zip::Codec::TraditionalEncryption::Decrypt.open" do
12
14
  TraditionalEncryptionSpecs.password,
13
15
  TraditionalEncryptionSpecs.mtime
14
16
  )
15
- d.class.should == Archive::Zip::Codec::TraditionalEncryption::Decrypt
17
+ d.must_be_instance_of(Archive::Zip::Codec::TraditionalEncryption::Decrypt)
16
18
  d.close
17
19
  end
18
20
 
@@ -22,7 +24,9 @@ describe "Archive::Zip::Codec::TraditionalEncryption::Decrypt.open" do
22
24
  TraditionalEncryptionSpecs.password,
23
25
  TraditionalEncryptionSpecs.mtime
24
26
  ) do |decryptor|
25
- decryptor.class.should == Archive::Zip::Codec::TraditionalEncryption::Decrypt
27
+ decryptor.must_be_instance_of(
28
+ Archive::Zip::Codec::TraditionalEncryption::Decrypt
29
+ )
26
30
  end
27
31
  end
28
32
 
@@ -34,6 +38,6 @@ describe "Archive::Zip::Codec::TraditionalEncryption::Decrypt.open" do
34
38
  ) do |decryptor|
35
39
  decryptor
36
40
  end
37
- d.closed?.should.be_true
41
+ d.closed?.must_equal(true)
38
42
  end
39
43
  end
@@ -1,18 +1,17 @@
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/traditional_encryption'
6
8
 
7
9
  describe "Archive::Zip::Codec::TraditionalEncryption::Decrypt#read" do
8
10
  it "calls the read method of the delegate" do
9
- delegate = mock('delegate')
10
- # RSpec's mocking facility supposedly supports this, but MSpec's does not as
11
- # of version 1.5.10.
12
- #delegate.should_receive(:read).with(an_instance_of(Fixnum)).at_least(:once).and_return { |n| "\000" * n }
13
- # Use the following instead for now.
14
- delegate.should_receive(:read).twice.and_return("\000" * 12, nil)
15
- delegate.should_receive(:close).and_return(nil)
11
+ delegate = MiniTest::Mock.new
12
+ delegate.expect(:read, "\000" * 12, [Integer])
13
+ delegate.expect(:read, nil, [Integer])
14
+ delegate.expect(:close, nil)
16
15
  Archive::Zip::Codec::TraditionalEncryption::Decrypt.open(
17
16
  delegate,
18
17
  TraditionalEncryptionSpecs.password,
@@ -29,7 +28,7 @@ describe "Archive::Zip::Codec::TraditionalEncryption::Decrypt#read" do
29
28
  TraditionalEncryptionSpecs.password,
30
29
  TraditionalEncryptionSpecs.mtime
31
30
  ) do |d|
32
- d.read.should == TraditionalEncryptionSpecs.test_data
31
+ d.read.must_equal(TraditionalEncryptionSpecs.test_data)
33
32
  end
34
33
  end
35
34
  end
@@ -55,7 +54,7 @@ describe "Archive::Zip::Codec::TraditionalEncryption::Decrypt#read" do
55
54
  rescue Errno::EAGAIN
56
55
  retry
57
56
  end
58
- buffer.should == TraditionalEncryptionSpecs.test_data
57
+ buffer.must_equal(TraditionalEncryptionSpecs.test_data)
59
58
  end
60
59
  end
61
60
  end
@@ -87,7 +86,7 @@ describe "Archive::Zip::Codec::TraditionalEncryption::Decrypt#read" do
87
86
  rescue Errno::EAGAIN
88
87
  retry
89
88
  end
90
- buffer.should == TraditionalEncryptionSpecs.test_data
89
+ buffer.must_equal(TraditionalEncryptionSpecs.test_data)
91
90
  end
92
91
  end
93
92
  end
@@ -119,7 +118,7 @@ describe "Archive::Zip::Codec::TraditionalEncryption::Decrypt#read" do
119
118
  rescue Errno::EINTR
120
119
  retry
121
120
  end
122
- buffer.should == TraditionalEncryptionSpecs.test_data
121
+ buffer.must_equal(TraditionalEncryptionSpecs.test_data)
123
122
  end
124
123
  end
125
124
  end