delayed_paperclip 2.9.1 → 2.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -2
- data/.travis.yml +5 -6
- data/Appraisals +1 -5
- data/CONTRIBUTING +0 -3
- data/README.md +43 -11
- data/Rakefile +0 -13
- data/delayed_paperclip.gemspec +3 -3
- data/gemfiles/3.2.gemfile +0 -1
- data/gemfiles/4.0.gemfile +0 -1
- data/gemfiles/4.1.gemfile +0 -1
- data/gemfiles/4.2.gemfile +0 -1
- data/lib/delayed_paperclip.rb +6 -7
- data/lib/delayed_paperclip/attachment.rb +12 -6
- data/lib/delayed_paperclip/jobs/active_job.rb +3 -5
- data/lib/delayed_paperclip/jobs/delayed_job.rb +3 -2
- data/lib/delayed_paperclip/jobs/resque.rb +2 -3
- data/lib/delayed_paperclip/jobs/sidekiq.rb +7 -1
- data/lib/delayed_paperclip/railtie.rb +1 -1
- data/lib/delayed_paperclip/url_generator.rb +19 -25
- data/lib/delayed_paperclip/version.rb +1 -1
- data/spec/delayed_paperclip/attachment_spec.rb +98 -26
- data/spec/delayed_paperclip/class_methods_spec.rb +20 -12
- data/spec/delayed_paperclip/instance_methods_spec.rb +8 -12
- data/spec/delayed_paperclip/url_generator_spec.rb +24 -24
- data/spec/delayed_paperclip_spec.rb +37 -22
- data/spec/integration/active_job_inline_spec.rb +3 -3
- data/spec/integration/active_job_resque_spec.rb +4 -7
- data/spec/integration/active_job_sidekiq_spec.rb +17 -18
- data/spec/integration/base_delayed_paperclip_spec.rb +5 -6
- data/spec/integration/delayed_job_spec.rb +3 -4
- data/spec/integration/examples/base.rb +33 -25
- data/spec/integration/resque_spec.rb +4 -6
- data/spec/integration/sidekiq_spec.rb +8 -11
- data/spec/spec_helper.rb +15 -0
- metadata +23 -19
- data/gemfiles/3.2.gemfile.lock +0 -162
- data/gemfiles/4.0.gemfile.lock +0 -156
- data/gemfiles/4.1.gemfile.lock +0 -156
- data/gemfiles/4.2.gemfile.lock +0 -181
- data/test/base_delayed_paperclip_test.rb +0 -254
- data/test/database.yml +0 -4
- data/test/test_helper.rb +0 -106
data/test/database.yml
DELETED
data/test/test_helper.rb
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
###
|
|
2
|
-
# DEPRECATED, Don't Use
|
|
3
|
-
###
|
|
4
|
-
|
|
5
|
-
require 'rubygems'
|
|
6
|
-
|
|
7
|
-
begin
|
|
8
|
-
require 'test/unit'
|
|
9
|
-
rescue
|
|
10
|
-
# we are probably Rails 4.2, so no Test::Unit here
|
|
11
|
-
# move along...
|
|
12
|
-
puts "No Test::Unit available. Skipping..."
|
|
13
|
-
exit(0)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
require 'mocha/setup'
|
|
17
|
-
require 'active_record'
|
|
18
|
-
require 'active_record/version'
|
|
19
|
-
require 'active_support'
|
|
20
|
-
require 'active_support/core_ext'
|
|
21
|
-
require 'logger'
|
|
22
|
-
require 'sqlite3'
|
|
23
|
-
|
|
24
|
-
begin
|
|
25
|
-
require 'pry'
|
|
26
|
-
rescue LoadError
|
|
27
|
-
# Pry is not available, just ignore.
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
require 'paperclip/railtie'
|
|
31
|
-
Paperclip::Railtie.insert
|
|
32
|
-
|
|
33
|
-
ROOT = File.join(File.dirname(__FILE__), '..')
|
|
34
|
-
RAILS_ROOT = ROOT
|
|
35
|
-
$LOAD_PATH << File.join(ROOT, 'lib')
|
|
36
|
-
|
|
37
|
-
require 'delayed_paperclip/railtie'
|
|
38
|
-
DelayedPaperclip::Railtie.insert
|
|
39
|
-
|
|
40
|
-
class Test::Unit::TestCase
|
|
41
|
-
def setup
|
|
42
|
-
silence_warnings do
|
|
43
|
-
Object.const_set(:Rails, stub('Rails', :root => ROOT, :env => 'test'))
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
FIXTURES_DIR = File.join(File.dirname(__FILE__), "fixtures")
|
|
49
|
-
config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
|
|
50
|
-
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
|
|
51
|
-
ActiveRecord::Base.establish_connection(config['test'])
|
|
52
|
-
Paperclip.logger = ActiveRecord::Base.logger
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
# Reset table and class with image_processing column or not
|
|
56
|
-
def reset_dummy(options = {})
|
|
57
|
-
options[:with_processed] = true unless options.key?(:with_processed)
|
|
58
|
-
build_dummy_table(options[:with_processed])
|
|
59
|
-
reset_class("Dummy", options)
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
# Dummy Table for images
|
|
63
|
-
# with or without image_processing column
|
|
64
|
-
def build_dummy_table(with_processed)
|
|
65
|
-
ActiveRecord::Base.connection.create_table :dummies, :force => true do |t|
|
|
66
|
-
t.string :name
|
|
67
|
-
t.string :image_file_name
|
|
68
|
-
t.string :image_content_type
|
|
69
|
-
t.integer :image_file_size
|
|
70
|
-
t.datetime :image_updated_at
|
|
71
|
-
t.boolean(:image_processing, :default => false) if with_processed
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
def reset_class(class_name, options)
|
|
77
|
-
# setup class and include paperclip
|
|
78
|
-
options[:paperclip] = {} if options[:paperclip].nil?
|
|
79
|
-
ActiveRecord::Base.send(:include, Paperclip::Glue)
|
|
80
|
-
Object.send(:remove_const, class_name) rescue nil
|
|
81
|
-
|
|
82
|
-
# Set class as a constant
|
|
83
|
-
klass = Object.const_set(class_name, Class.new(ActiveRecord::Base))
|
|
84
|
-
|
|
85
|
-
# Setup class with paperclip and delayed paperclip
|
|
86
|
-
klass.class_eval do
|
|
87
|
-
include Paperclip::Glue
|
|
88
|
-
|
|
89
|
-
has_attached_file :image, options[:paperclip]
|
|
90
|
-
options.delete(:paperclip)
|
|
91
|
-
|
|
92
|
-
validates_attachment :image, :content_type => { :content_type => "image/png" }
|
|
93
|
-
|
|
94
|
-
process_in_background :image, options if options[:with_processed]
|
|
95
|
-
|
|
96
|
-
after_update :reprocess if options[:with_after_update_callback]
|
|
97
|
-
|
|
98
|
-
def reprocess
|
|
99
|
-
image.reprocess!
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
klass.reset_column_information
|
|
105
|
-
klass
|
|
106
|
-
end
|