rails-uploader 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. data/README.md +9 -1
  2. data/app/controllers/uploader/attachments_controller.rb +7 -2
  3. data/app/views/uploader/default/_download.html.erb +4 -2
  4. data/app/views/uploader/default/_upload.html.erb +1 -1
  5. data/lib/uploader.rb +1 -1
  6. data/lib/uploader/asset.rb +22 -0
  7. data/lib/uploader/fileuploads.rb +18 -11
  8. data/lib/uploader/helpers/field_tag.rb +2 -2
  9. data/lib/uploader/helpers/form_tag_helper.rb +1 -2
  10. data/lib/uploader/version.rb +1 -1
  11. data/spec/dummy/db/migrate/20120508093416_create_assets.rb +3 -1
  12. data/spec/dummy/db/test.sqlite3 +0 -0
  13. data/spec/dummy/log/test.log +2248 -0
  14. data/spec/dummy/public/uploads/picture/data/1/thumb_rails.png +0 -0
  15. data/spec/dummy/public/uploads/picture/data/3/rails.png +0 -0
  16. data/spec/dummy/public/uploads/picture/data/3/thumb_rails.png +0 -0
  17. data/spec/dummy/public/uploads/tmp/20130905-1539-33540-9729/rails.png +0 -0
  18. data/spec/dummy/public/uploads/tmp/20130905-1539-33540-9729/thumb_rails.png +0 -0
  19. data/spec/dummy/public/uploads/tmp/20130905-1542-33540-2188/rails.png +0 -0
  20. data/spec/dummy/public/uploads/tmp/20130905-1542-33540-2188/thumb_rails.png +0 -0
  21. data/spec/dummy/public/uploads/tmp/20130905-1542-33540-8490/rails.png +0 -0
  22. data/spec/dummy/public/uploads/tmp/20130905-1542-33540-8490/thumb_rails.png +0 -0
  23. data/spec/dummy/public/uploads/tmp/20130905-1722-34183-6034/rails.png +0 -0
  24. data/spec/dummy/public/uploads/tmp/20130905-1722-34183-6034/thumb_rails.png +0 -0
  25. data/spec/dummy/public/uploads/tmp/20130905-1723-34214-7553/rails.png +0 -0
  26. data/spec/dummy/public/uploads/tmp/20130905-1723-34214-7553/thumb_rails.png +0 -0
  27. data/spec/dummy/public/uploads/tmp/20130905-1726-34214-2817/rails.png +0 -0
  28. data/spec/dummy/public/uploads/tmp/20130905-1726-34214-2817/thumb_rails.png +0 -0
  29. data/spec/dummy/public/uploads/tmp/20130905-1726-34214-5471/rails.png +0 -0
  30. data/spec/dummy/public/uploads/tmp/20130905-1726-34214-5471/thumb_rails.png +0 -0
  31. data/spec/dummy/public/uploads/tmp/20130905-1726-34214-9281/rails.png +0 -0
  32. data/spec/dummy/public/uploads/tmp/20130905-1726-34214-9281/thumb_rails.png +0 -0
  33. data/spec/requests/attachments_controller_spec.rb +9 -1
  34. data/spec/uploader_spec.rb +1 -1
  35. metadata +40 -2
@@ -26,9 +26,17 @@ describe Uploader::AttachmentsController do
26
26
  @asset = FactoryGirl.create(:picture)
27
27
 
28
28
  lambda {
29
- delete "/uploader/attachments/#{@asset.id}", {:klass => "Picture"}
29
+ delete "/uploader/attachments/#{@asset.public_token}", {:klass => "Picture"}
30
30
  }.should change { Picture.count }.by(-1)
31
31
  end
32
+
33
+ it "should not destroy asset with not exists guid" do
34
+ @asset = FactoryGirl.create(:picture)
35
+
36
+ lambda {
37
+ delete "/uploader/attachments/wrong", {:klass => "Picture"}
38
+ }.should raise_error(ActionController::RoutingError)
39
+ end
32
40
 
33
41
  it "should raise 404 error with wrong class" do
34
42
  lambda {
@@ -8,7 +8,7 @@ describe Uploader do
8
8
  it "should generate random string" do
9
9
  value = Uploader.guid
10
10
  value.should_not be_blank
11
- value.size.should == 10
11
+ value.size.should == 20
12
12
  end
13
13
 
14
14
  it "should find all precompile assets" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-uploader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-07-05 00:00:00.000000000 Z
13
+ date: 2013-09-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: jquery-ui-rails
@@ -153,12 +153,31 @@ files:
153
153
  - spec/dummy/db/migrate/20120508093416_create_assets.rb
154
154
  - spec/dummy/db/migrate/20120508093830_create_articles.rb
155
155
  - spec/dummy/db/test.sqlite3
156
+ - spec/dummy/log/test.log
156
157
  - spec/dummy/public/404.html
157
158
  - spec/dummy/public/422.html
158
159
  - spec/dummy/public/500.html
159
160
  - spec/dummy/public/favicon.ico
160
161
  - spec/dummy/public/uploads/picture/data/1/rails.png
161
162
  - spec/dummy/public/uploads/picture/data/1/thumb_rails.png
163
+ - spec/dummy/public/uploads/picture/data/3/rails.png
164
+ - spec/dummy/public/uploads/picture/data/3/thumb_rails.png
165
+ - spec/dummy/public/uploads/tmp/20130905-1539-33540-9729/rails.png
166
+ - spec/dummy/public/uploads/tmp/20130905-1539-33540-9729/thumb_rails.png
167
+ - spec/dummy/public/uploads/tmp/20130905-1542-33540-2188/rails.png
168
+ - spec/dummy/public/uploads/tmp/20130905-1542-33540-2188/thumb_rails.png
169
+ - spec/dummy/public/uploads/tmp/20130905-1542-33540-8490/rails.png
170
+ - spec/dummy/public/uploads/tmp/20130905-1542-33540-8490/thumb_rails.png
171
+ - spec/dummy/public/uploads/tmp/20130905-1722-34183-6034/rails.png
172
+ - spec/dummy/public/uploads/tmp/20130905-1722-34183-6034/thumb_rails.png
173
+ - spec/dummy/public/uploads/tmp/20130905-1723-34214-7553/rails.png
174
+ - spec/dummy/public/uploads/tmp/20130905-1723-34214-7553/thumb_rails.png
175
+ - spec/dummy/public/uploads/tmp/20130905-1726-34214-2817/rails.png
176
+ - spec/dummy/public/uploads/tmp/20130905-1726-34214-2817/thumb_rails.png
177
+ - spec/dummy/public/uploads/tmp/20130905-1726-34214-5471/rails.png
178
+ - spec/dummy/public/uploads/tmp/20130905-1726-34214-5471/thumb_rails.png
179
+ - spec/dummy/public/uploads/tmp/20130905-1726-34214-9281/rails.png
180
+ - spec/dummy/public/uploads/tmp/20130905-1726-34214-9281/thumb_rails.png
162
181
  - spec/dummy/Rakefile
163
182
  - spec/dummy/README.rdoc
164
183
  - spec/dummy/script/rails
@@ -224,12 +243,31 @@ test_files:
224
243
  - spec/dummy/db/migrate/20120508093416_create_assets.rb
225
244
  - spec/dummy/db/migrate/20120508093830_create_articles.rb
226
245
  - spec/dummy/db/test.sqlite3
246
+ - spec/dummy/log/test.log
227
247
  - spec/dummy/public/404.html
228
248
  - spec/dummy/public/422.html
229
249
  - spec/dummy/public/500.html
230
250
  - spec/dummy/public/favicon.ico
231
251
  - spec/dummy/public/uploads/picture/data/1/rails.png
232
252
  - spec/dummy/public/uploads/picture/data/1/thumb_rails.png
253
+ - spec/dummy/public/uploads/picture/data/3/rails.png
254
+ - spec/dummy/public/uploads/picture/data/3/thumb_rails.png
255
+ - spec/dummy/public/uploads/tmp/20130905-1539-33540-9729/rails.png
256
+ - spec/dummy/public/uploads/tmp/20130905-1539-33540-9729/thumb_rails.png
257
+ - spec/dummy/public/uploads/tmp/20130905-1542-33540-2188/rails.png
258
+ - spec/dummy/public/uploads/tmp/20130905-1542-33540-2188/thumb_rails.png
259
+ - spec/dummy/public/uploads/tmp/20130905-1542-33540-8490/rails.png
260
+ - spec/dummy/public/uploads/tmp/20130905-1542-33540-8490/thumb_rails.png
261
+ - spec/dummy/public/uploads/tmp/20130905-1722-34183-6034/rails.png
262
+ - spec/dummy/public/uploads/tmp/20130905-1722-34183-6034/thumb_rails.png
263
+ - spec/dummy/public/uploads/tmp/20130905-1723-34214-7553/rails.png
264
+ - spec/dummy/public/uploads/tmp/20130905-1723-34214-7553/thumb_rails.png
265
+ - spec/dummy/public/uploads/tmp/20130905-1726-34214-2817/rails.png
266
+ - spec/dummy/public/uploads/tmp/20130905-1726-34214-2817/thumb_rails.png
267
+ - spec/dummy/public/uploads/tmp/20130905-1726-34214-5471/rails.png
268
+ - spec/dummy/public/uploads/tmp/20130905-1726-34214-5471/thumb_rails.png
269
+ - spec/dummy/public/uploads/tmp/20130905-1726-34214-9281/rails.png
270
+ - spec/dummy/public/uploads/tmp/20130905-1726-34214-9281/thumb_rails.png
233
271
  - spec/dummy/Rakefile
234
272
  - spec/dummy/README.rdoc
235
273
  - spec/dummy/script/rails