delayed_paperclip 2.9.0 → 2.9.1

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: d9d8e927d5a6ecdf619755a0593874e1d6aa9125
4
- data.tar.gz: e3408926c0a1b18b5f850dd2396ffcb767edd893
3
+ metadata.gz: 41fd7daaa3126fd153f1448405465ab92d983833
4
+ data.tar.gz: 5953ed040cea15002ca58e269dd9b12eace3ed9c
5
5
  SHA512:
6
- metadata.gz: 4e2c42c5a2babfc35dc485b990a587d6eb77081c6e26d23c163926c2152a981a3a1a08c11a5f463b351e115db20436cf43c2771d20d96fc9a1ef7633ce468dfc
7
- data.tar.gz: e4168634498e359e1b6969feecf5c164be9858b521172a6f8ef79977cf17ef7add5d105586af5d3bddeca85734bbfae0d03f466737f29c6cfba859f280d53a6e
6
+ metadata.gz: 0558c10976a587d713e68e4b22f3bbfe0d5cbeaf84abad212d510b282bc0e33918dd3e3a98c60b5d05c56efd2e0a5a6255b35346214c0a9acb4d310a8e4bea3f
7
+ data.tar.gz: c0db6281bbf54e20ef7489ae2ae094809471ad2d8fccc5578d8a52f00b507d49f6d37dbf148adfc82887a6a15a602a30f8b8d9062480ed56891cac0450d0c40b
data/ChangeLog CHANGED
@@ -1,4 +1 @@
1
- 2.6.1
2
- * Wrote Unit tests
3
- * Rewrote Integration tests in rspec
4
- * Paperclip 3.5 compatibility
1
+ -> https://github.com/jrgifford/delayed_paperclip/releases
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- delayed_paperclip (2.8.0)
4
+ delayed_paperclip (2.9.1)
5
5
  paperclip (>= 3.3)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- delayed_paperclip (2.8.0)
4
+ delayed_paperclip (2.9.1)
5
5
  paperclip (>= 3.3)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- delayed_paperclip (2.8.0)
4
+ delayed_paperclip (2.9.1)
5
5
  paperclip (>= 3.3)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- delayed_paperclip (2.8.0)
4
+ delayed_paperclip (2.9.1)
5
5
  paperclip (>= 3.3)
6
6
 
7
7
  GEM
@@ -12,7 +12,7 @@ module DelayedPaperclip
12
12
  module InstanceMethods
13
13
 
14
14
  def delayed_options
15
- @options[:delayed]
15
+ options[:delayed]
16
16
  end
17
17
 
18
18
  # Attr accessor in Paperclip
@@ -35,9 +35,8 @@ module DelayedPaperclip
35
35
  end
36
36
 
37
37
  def split_processing?
38
- options[:only_process] &&
39
- options[:only_process] !=
40
- options[:delayed][:only_process]
38
+ options[:only_process] && delayed_options &&
39
+ options[:only_process] != delayed_options[:only_process]
41
40
  end
42
41
 
43
42
  def processing?
@@ -11,11 +11,12 @@ module DelayedPaperclip
11
11
  def for_with_processed(style_name, options)
12
12
  most_appropriate_url = @attachment.processing_style?(style_name) ? most_appropriate_url(style_name) : most_appropriate_url_without_processed
13
13
 
14
- escape_url_as_needed(
15
- timestamp_as_needed(
14
+ timestamp_as_needed(
15
+ escape_url_as_needed(
16
16
  @attachment_options[:interpolator].interpolate(most_appropriate_url, @attachment, style_name),
17
17
  options
18
- ), options)
18
+ ),
19
+ options)
19
20
  end
20
21
 
21
22
  # This method is a mess
@@ -1,3 +1,3 @@
1
1
  module DelayedPaperclip
2
- VERSION = "2.9.0"
2
+ VERSION = "2.9.1"
3
3
  end
@@ -33,9 +33,18 @@ describe DelayedPaperclip::Attachment do
33
33
  dummy.image.stubs(:delay_processing?).returns true
34
34
  dummy.image.post_processing_with_delay.should be_false
35
35
  end
36
+
37
+ context "on a non-delayed image" do
38
+ let(:dummy_options) { { with_processed: false } }
39
+
40
+ it "is false if delay_processing? is true" do
41
+ dummy.image.stubs(:delay_processing?).returns true
42
+ dummy.image.post_processing_with_delay.should be_false
43
+ end
44
+ end
36
45
  end
37
46
 
38
- describe "delay_processing?" do
47
+ describe "#delay_processing?" do
39
48
  it "returns delayed_options existence if post_processing_with_delay is nil" do
40
49
  dummy.image.post_processing_with_delay = nil
41
50
  dummy.image.delay_processing?.should be_true
@@ -47,7 +56,7 @@ describe DelayedPaperclip::Attachment do
47
56
  end
48
57
  end
49
58
 
50
- describe "processing?" do
59
+ describe "#processing?" do
51
60
  it "delegates to the dummy instance" do
52
61
  dummy.expects(:image_processing?)
53
62
  dummy.image.processing?
@@ -62,7 +71,7 @@ describe DelayedPaperclip::Attachment do
62
71
  end
63
72
  end
64
73
 
65
- describe "processing_stye?" do
74
+ describe "#processing_style?" do
66
75
  let(:style) { :background }
67
76
  let(:processing_style?) { dummy.image.processing_style?(style) }
68
77
 
@@ -107,7 +116,7 @@ describe DelayedPaperclip::Attachment do
107
116
  end
108
117
  end
109
118
 
110
- describe "delayed_only_process" do
119
+ describe "#delayed_only_process" do
111
120
  context "without only_process options" do
112
121
  it "returns []" do
113
122
  expect(dummy.image.delayed_only_process).to eq []
@@ -135,7 +144,7 @@ describe DelayedPaperclip::Attachment do
135
144
  end
136
145
  end
137
146
 
138
- describe "process_delayed!" do
147
+ describe "#process_delayed!" do
139
148
  it "sets job_is_processing to true" do
140
149
  dummy.image.expects(:job_is_processing=).with(true).once
141
150
  dummy.image.expects(:job_is_processing=).with(false).once
@@ -57,6 +57,32 @@ describe DelayedPaperclip::UrlGenerator do
57
57
  expect(attachment.url(:online)).to eql "/system/dummies/images/000/000/001/online/12k.png"
58
58
  end
59
59
  end
60
+
61
+ context "should be able to escape (, ), [, and ]." do
62
+ def generate(expected, updated_at=nil)
63
+ mock_interpolator = MockInterpolator.new(result: expected)
64
+ options = { interpolator: mock_interpolator }
65
+ url_generator = Paperclip::UrlGenerator.new(attachment, options)
66
+ attachment.stubs(:updated_at).returns updated_at
67
+ url_generator.for(:style_name, {escape: true, timestamp: !!updated_at})
68
+ end
69
+
70
+
71
+ it "interpolates correctly without timestamp" do
72
+ expect(
73
+ "the%28expected%29result%5B%5D"
74
+ ).to be == generate("the(expected)result[]")
75
+ end
76
+
77
+ it "does not interpolate timestamp" do
78
+ expected = "the(expected)result[]"
79
+ updated_at = 1231231234
80
+
81
+ expect(
82
+ "the%28expected%29result%5B%5D?#{updated_at}"
83
+ ).to be == generate(expected, updated_at)
84
+ end
85
+ end
60
86
  end
61
87
  end
62
88
 
data/spec/spec_helper.rb CHANGED
@@ -24,6 +24,8 @@ Paperclip::Railtie.insert
24
24
  require 'delayed_paperclip/railtie'
25
25
  DelayedPaperclip::Railtie.insert
26
26
 
27
+
28
+
27
29
  # silence deprecation warnings in rails 4.2
28
30
  if ActiveRecord::Base.respond_to?(:raise_in_transactional_callbacks=)
29
31
  ActiveRecord::Base.raise_in_transactional_callbacks = true
@@ -49,6 +51,10 @@ RSpec.configure do |config|
49
51
  config.run_all_when_everything_filtered = true
50
52
  end
51
53
 
54
+ # In order to not duplicate code directly from Paperclip's spec support
55
+ # We're requiring the MockInterpolator object to be used
56
+ require Gem.find_files("../spec/support/mock_interpolator").first
57
+
52
58
  Dir["./spec/integration/examples/*.rb"].sort.each {|f| require f}
53
59
 
54
60
  # Reset table and class with image_processing column or not
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delayed_paperclip
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.0
4
+ version: 2.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Storimer
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-12-23 00:00:00.000000000 Z
14
+ date: 2015-02-06 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: paperclip