dynamic_paperclip 1.0.0a.3 → 1.0.0.alpha.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,6 @@
1
1
  rails:
2
2
  id: 1
3
3
  image_file_name: 'rails.png'
4
- image_content_type: 'image/png'
4
+ image_content_type: 'image/png'
5
+ without_image:
6
+ id: 2
@@ -1,6 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class DynamicAttachmentStylesTest < ActionDispatch::IntegrationTest
4
+ self.fixture_path = FIXTURES_DIR
4
5
  fixtures :photos
5
6
 
6
7
  should 'generate dynamic style and send it to the client' do
@@ -8,8 +9,8 @@ class DynamicAttachmentStylesTest < ActionDispatch::IntegrationTest
8
9
 
9
10
  path_to_dynamic_style = photo.image.path('dynamic_100x100')
10
11
 
11
- # This style should not exist yet
12
- assert !File.exists?(path_to_dynamic_style), "style to be generated already exists"
12
+ # Ensure dynamic style does not exist yet
13
+ FileUtils.rm_rf File.dirname path_to_dynamic_style
13
14
 
14
15
  # The style should be created right now when we request it
15
16
  get photo.image.dynamic_url('100x100')
@@ -17,8 +18,8 @@ class DynamicAttachmentStylesTest < ActionDispatch::IntegrationTest
17
18
  assert_response :success
18
19
  assert_equal 'image/png', @response.headers['Content-Type']
19
20
 
20
- # Make sure we respond with the style that previously did not exist
21
- assert FileUtils.compare_stream StringIO.new(@response.body), open(path_to_dynamic_style)
21
+ # Make sure new style was generated
22
+ assert File.exist?(path_to_dynamic_style)
22
23
 
23
24
  # Clean up dynamic style we just created
24
25
  FileUtils.rm_rf File.dirname path_to_dynamic_style
data/test/test_helper.rb CHANGED
@@ -13,9 +13,6 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
13
13
 
14
14
  ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
15
15
 
16
- # Load fixtures from the engine
17
- if ActiveSupport::TestCase.method_defined?(:fixture_path=)
18
- ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
19
- end
16
+ ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
20
17
 
21
18
  FIXTURES_DIR = File.join(File.dirname(__FILE__), "fixtures")
@@ -8,7 +8,7 @@ class Foo < ActiveRecord::Base
8
8
  :url => '/system/:class/:attachment/:id_partition/:style/:filename'
9
9
  end
10
10
 
11
- class DynamicPaperclip::AttachmentStyleGeneratorTest < Test::Unit::TestCase
11
+ class DynamicPaperclip::AttachmentStyleGeneratorTest < MiniTest::Unit::TestCase
12
12
  include Rack::Test::Methods
13
13
 
14
14
  def app
@@ -51,4 +51,12 @@ class AttachmentTest < ActiveSupport::TestCase
51
51
 
52
52
  assert_equal [:thumb], attachment.instance_variable_get(:@queued_for_delete)
53
53
  end
54
+
55
+ should 'return true from query method when attachment is set' do
56
+ assert photos(:rails).image?
57
+ end
58
+
59
+ should 'return false from query method when attachment is not set' do
60
+ assert !photos(:without_image).image?
61
+ end
54
62
  end
@@ -2,7 +2,7 @@ require 'test_helper'
2
2
 
3
3
  class Foo < ActiveRecord::Base; end
4
4
 
5
- class HasAttachedFileTest < Test::Unit::TestCase
5
+ class HasAttachedFileTest < MiniTest::Unit::TestCase
6
6
  should 'register dynamic attachment' do
7
7
  DynamicPaperclip::AttachmentRegistry.expects(:register).with(Foo, :bar, { url: '/system/foos/bars/:id_partition/:style/:filename' })
8
8
 
metadata CHANGED
@@ -1,144 +1,141 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamic_paperclip
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0a.3
5
- prerelease: 5
4
+ version: 1.0.0.alpha.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jim Ryan
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-08-14 00:00:00.000000000 Z
11
+ date: 2017-06-09 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rack
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: paperclip
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: 3.5.1
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: 3.5.1
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: activesupport
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: actionpack
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '3.2'
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '3.2'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: sqlite3
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - ">="
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - ">="
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: shoulda
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - ">="
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - ">="
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: mocha
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - ">="
116
102
  - !ruby/object:Gem::Version
117
103
  version: '0'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - ">="
124
109
  - !ruby/object:Gem::Version
125
110
  version: '0'
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: rails
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
- - - ! '>'
115
+ - - "~>"
132
116
  - !ruby/object:Gem::Version
133
- version: '3.2'
117
+ version: 4.2.8
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
- - - ! '>'
122
+ - - "~>"
140
123
  - !ruby/object:Gem::Version
141
- version: '3.2'
124
+ version: 4.2.8
125
+ - !ruby/object:Gem::Dependency
126
+ name: appraisal
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
142
139
  description: Let's your views define attachment styles, and delays processing all
143
140
  the way to the first user who requests it.
144
141
  email:
@@ -147,6 +144,10 @@ executables: []
147
144
  extensions: []
148
145
  extra_rdoc_files: []
149
146
  files:
147
+ - MIT-LICENSE
148
+ - README.md
149
+ - Rakefile
150
+ - lib/dynamic_paperclip.rb
150
151
  - lib/dynamic_paperclip/attachment.rb
151
152
  - lib/dynamic_paperclip/attachment_registry.rb
152
153
  - lib/dynamic_paperclip/attachment_style_generator.rb
@@ -158,16 +159,13 @@ files:
158
159
  - lib/dynamic_paperclip/style_naming.rb
159
160
  - lib/dynamic_paperclip/url_security.rb
160
161
  - lib/dynamic_paperclip/version.rb
161
- - lib/dynamic_paperclip.rb
162
162
  - lib/generators/dynamic_paperclip/install_generator.rb
163
163
  - lib/tasks/dynamic_paperclip.rake
164
- - MIT-LICENSE
165
- - Rakefile
166
- - README.md
164
+ - test/dummy/Rakefile
167
165
  - test/dummy/app/controllers/application_controller.rb
168
166
  - test/dummy/app/models/photo.rb
167
+ - test/dummy/config.ru
169
168
  - test/dummy/config/application.rb
170
- - test/dummy/config/boot.rb
171
169
  - test/dummy/config/database.yml
172
170
  - test/dummy/config/environment.rb
173
171
  - test/dummy/config/environments/test.rb
@@ -177,12 +175,9 @@ files:
177
175
  - test/dummy/config/initializers/wrap_parameters.rb
178
176
  - test/dummy/config/locales/en.yml
179
177
  - test/dummy/config/routes.rb
180
- - test/dummy/config.ru
181
- - test/dummy/db/development.sqlite3
182
178
  - test/dummy/db/migrate/20131102002336_create_photos.rb
183
179
  - test/dummy/db/schema.rb
184
180
  - test/dummy/db/test.sqlite3
185
- - test/dummy/log/development.log
186
181
  - test/dummy/log/test.log
187
182
  - test/dummy/public/404.html
188
183
  - test/dummy/public/422.html
@@ -190,7 +185,6 @@ files:
190
185
  - test/dummy/public/favicon.ico
191
186
  - test/dummy/public/system/photos/images/000/000/001/dynamic_42x42/rails.png
192
187
  - test/dummy/public/system/photos/images/000/000/001/original/rails.png
193
- - test/dummy/Rakefile
194
188
  - test/dummy/script/rails
195
189
  - test/dynamic_paperclip_test.rb
196
190
  - test/fixtures/photos.yml
@@ -202,39 +196,33 @@ files:
202
196
  - test/unit/attachment_style_generator_test.rb
203
197
  - test/unit/attachment_test.rb
204
198
  - test/unit/has_attached_file_test.rb
205
- - test/unit/rake_test.rb
206
199
  homepage: http://github.com/room118solutions/dynamic_paperclip
207
200
  licenses: []
201
+ metadata: {}
208
202
  post_install_message:
209
203
  rdoc_options: []
210
204
  require_paths:
211
205
  - lib
212
206
  required_ruby_version: !ruby/object:Gem::Requirement
213
- none: false
214
207
  requirements:
215
- - - ! '>='
208
+ - - ">="
216
209
  - !ruby/object:Gem::Version
217
210
  version: '0'
218
- segments:
219
- - 0
220
- hash: 2099875005983279561
221
211
  required_rubygems_version: !ruby/object:Gem::Requirement
222
- none: false
223
212
  requirements:
224
- - - ! '>'
213
+ - - ">"
225
214
  - !ruby/object:Gem::Version
226
215
  version: 1.3.1
227
216
  requirements: []
228
217
  rubyforge_project:
229
- rubygems_version: 1.8.25
218
+ rubygems_version: 2.5.1
230
219
  signing_key:
231
- specification_version: 3
220
+ specification_version: 4
232
221
  summary: Generate Paperclip attachment styles on the fly
233
222
  test_files:
234
223
  - test/dummy/app/controllers/application_controller.rb
235
224
  - test/dummy/app/models/photo.rb
236
225
  - test/dummy/config/application.rb
237
- - test/dummy/config/boot.rb
238
226
  - test/dummy/config/database.yml
239
227
  - test/dummy/config/environment.rb
240
228
  - test/dummy/config/environments/test.rb
@@ -245,11 +233,9 @@ test_files:
245
233
  - test/dummy/config/locales/en.yml
246
234
  - test/dummy/config/routes.rb
247
235
  - test/dummy/config.ru
248
- - test/dummy/db/development.sqlite3
249
236
  - test/dummy/db/migrate/20131102002336_create_photos.rb
250
237
  - test/dummy/db/schema.rb
251
238
  - test/dummy/db/test.sqlite3
252
- - test/dummy/log/development.log
253
239
  - test/dummy/log/test.log
254
240
  - test/dummy/public/404.html
255
241
  - test/dummy/public/422.html
@@ -269,4 +255,3 @@ test_files:
269
255
  - test/unit/attachment_style_generator_test.rb
270
256
  - test/unit/attachment_test.rb
271
257
  - test/unit/has_attached_file_test.rb
272
- - test/unit/rake_test.rb
@@ -1,10 +0,0 @@
1
- require 'rubygems'
2
- gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
-
4
- if File.exist?(gemfile)
5
- ENV['BUNDLE_GEMFILE'] = gemfile
6
- require 'bundler'
7
- Bundler.setup
8
- end
9
-
10
- $:.unshift File.expand_path('../../../../lib', __FILE__)
Binary file
@@ -1,24 +0,0 @@
1
- Connecting to database specified by database.yml
2
- Connecting to database specified by database.yml
3
- Connecting to database specified by database.yml
4
- Connecting to database specified by database.yml
5
-  (0.1ms) select sqlite_version(*)
6
-  (0.8ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
7
-  (0.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
8
-  (4.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
9
- Migrating to CreatePhotos (20131102002336)
10
-  (0.0ms) begin transaction
11
-  (0.4ms) CREATE TABLE "photos" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "image_file_name" varchar(255), "image_content_type" varchar(255), "image_file_size" integer, "image_updated_at" datetime, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
12
-  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20131102002336')
13
-  (0.6ms) commit transaction
14
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
15
- Connecting to database specified by database.yml
16
-  (0.1ms) select sqlite_version(*)
17
-  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
18
-  (0.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
19
-  (1.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
20
- Connecting to database specified by database.yml
21
-  (0.1ms) select sqlite_version(*)
22
-  (1.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
23
-  (0.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
24
-  (1.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
@@ -1,15 +0,0 @@
1
- require 'test_helper'
2
- # require 'rake'
3
- load 'tasks/paperclip.rake'
4
-
5
- class RakeTest < Test::Unit::TestCase
6
- context "calling `rake dynamic_paperclip:remove_style`" do
7
- setup do
8
-
9
- end
10
-
11
- should 'queue dynamic style for delete and flush deletes' do
12
- ::Rake::Task['dynamic_paperclip:remove_style'].execute
13
- end
14
- end
15
- end