paperclip-deflater 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 539dd168f00b6c091360f30478cad895785a6934
4
- data.tar.gz: be6cbe7df876926c11981631be5b21f181f886b9
3
+ metadata.gz: 0dd150f55ee5cd1546e2fabb1f79de33123dbac6
4
+ data.tar.gz: 115cfeed1efbb5368788909402f7aeb33180739e
5
5
  SHA512:
6
- metadata.gz: 8399e7e84341b206c85a97311f254b379014765f7d2d466491a69ed2b821e1b1700aea2df8c6d986b35d9919929a368348729f203b2187ba9f42d2cbd869fc65
7
- data.tar.gz: adb2cb920abebc405886b46f2bc4d500d77a206496d5f47ba111377f28387ba0567bf41d25d2ce6f8e285bfc039172cc19eb8d60872a645f50281412e50cd5b1
6
+ metadata.gz: 83dfc7c024c791b69b28620adfc8ef1bd05811d4061ad0a648ccf39d6f15e6c1b8ca3f86b582492db74c92b5bcec34d213e57f6132420ea32e5e504a9f3befd9
7
+ data.tar.gz: f52376327d04a63029eea8c72e0056ebbc405e68b8075460d2dcb5ed2810905f396f5cd1dd630d9cbafd1a98768f0b98a1a2243271e70eec2e31f88bcad4c711
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -15,10 +15,12 @@ module Paperclip
15
15
  dst = create_tempfile
16
16
  begin
17
17
  gz = Zlib::GzipWriter.new(dst, level, strategy)
18
- gz.write(@file.read)
19
- ensure
20
- gz.close
18
+ gz.write @file.read
19
+ rescue ::Exception => e
20
+ gz.close rescue nil
21
+ raise e
21
22
  end
23
+ gz.close
22
24
  @file.rewind
23
25
  dst.open
24
26
 
@@ -28,6 +28,37 @@ describe Paperclip::Processors::Gzip do
28
28
  let(:options) { {gzip_options: {level: Zlib::BEST_COMPRESSION}} }
29
29
  include_examples "deflate"
30
30
  end
31
+ context "gzip failed to close" do
32
+ before do
33
+ @error = RuntimeError.new "error"
34
+ @writer = {}
35
+ allow(Zlib::GzipWriter).to receive(:new).and_return @writer
36
+ allow(@writer).to receive(:write).and_return nil
37
+ end
38
+
39
+ it "raises an error to close" do
40
+ expect(@writer).to receive(:close).and_raise @error
41
+ expect {
42
+ subject.make
43
+ }.to raise_error @error
44
+ end
45
+ end
46
+ context "gzip failed to write" do
47
+ before do
48
+ @error1 = RuntimeError.new "error1"
49
+ @error2 = RuntimeError.new "error2"
50
+ @writer = {}
51
+ allow(Zlib::GzipWriter).to receive(:new).and_return @writer
52
+ allow(@writer).to receive(:write).and_raise @error1
53
+ end
54
+
55
+ it "does not raise an error to close" do
56
+ expect(@writer).to receive(:close).and_raise @error2
57
+ expect {
58
+ subject.make
59
+ }.to raise_error @error1
60
+ end
61
+ end
31
62
  end
32
63
  end
33
64
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paperclip-deflater
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daisuke Taniwaki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-19 00:00:00.000000000 Z
11
+ date: 2015-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: paperclip
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  version: '0'
116
116
  requirements: []
117
117
  rubyforge_project:
118
- rubygems_version: 2.4.3
118
+ rubygems_version: 2.4.5
119
119
  signing_key:
120
120
  specification_version: 4
121
121
  summary: Deflate Processor for Paperclip
@@ -127,3 +127,4 @@ test_files:
127
127
  - spec/paperclip/processors/plain_spec.rb
128
128
  - spec/spec_helper.rb
129
129
  - spec/support/files.rb
130
+ has_rdoc: