attachs 0.3.2 → 0.3.5
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/README.rdoc +7 -1
- data/lib/attachs/active_record/base.rb +41 -46
- data/lib/attachs/storages/local.rb +8 -3
- data/lib/attachs/storages/s3.rb +21 -10
- data/lib/attachs/types/file.rb +16 -8
- data/lib/attachs/types/image.rb +27 -9
- data/lib/attachs/validators/attachment_content_type_validator.rb +3 -3
- data/lib/attachs/validators/attachment_presence_validator.rb +2 -2
- data/lib/attachs/validators/attachment_size_validator.rb +2 -8
- data/lib/attachs/validators/base.rb +1 -1
- data/lib/attachs/version.rb +1 -1
- data/lib/tasks/attachs_tasks.rake +4 -3
- data/test/dummy/app/models/all_attached.rb +1 -1
- data/test/dummy/app/models/private_file_attached.rb +3 -0
- data/test/dummy/app/models/private_image_attached.rb +3 -0
- data/test/dummy/config/application.rb +3 -2
- data/test/dummy/config/database.yml +1 -1
- data/test/dummy/log/test.log +3867 -0
- data/test/dummy/tmp/uploads/files/13898788260004868.txt +1 -0
- data/test/local_file_record_test.rb +11 -0
- data/test/test_helper.rb +2 -2
- metadata +9 -7
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/test.sqlite3 +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
1234567890
|
@@ -17,4 +17,15 @@ class LocalFileRecordTest < ActiveSupport::TestCase
|
|
17
17
|
assert !@record.file.exists?
|
18
18
|
end
|
19
19
|
|
20
|
+
test "should delete correctly using delete_attr method" do
|
21
|
+
uploads_path = Rails.root.join('tmp', 'uploads', 'files', @record.file.filename)
|
22
|
+
|
23
|
+
@record.delete_file = '1'
|
24
|
+
assert @record.file_changed?
|
25
|
+
|
26
|
+
@record.save
|
27
|
+
assert !::File.exists?(uploads_path)
|
28
|
+
assert !@record.file.exists?
|
29
|
+
end
|
30
|
+
|
20
31
|
end
|
data/test/test_helper.rb
CHANGED
@@ -34,8 +34,8 @@ class ActiveSupport::TestCase
|
|
34
34
|
|
35
35
|
def fixture_file_upload_s3(fixture, type, path, default=false)
|
36
36
|
upload = fixture_file_upload(fixture, type)
|
37
|
-
storage = Attachs::Storages::S3.new(default)
|
38
|
-
storage.store
|
37
|
+
storage = Attachs::Storages::S3.new(default, false)
|
38
|
+
storage.store upload, path
|
39
39
|
end
|
40
40
|
|
41
41
|
def assert_object_s3(url)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attachs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mattways
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -90,6 +90,8 @@ files:
|
|
90
90
|
- test/dummy/app/models/all_attached.rb
|
91
91
|
- test/dummy/app/models/file_attached.rb
|
92
92
|
- test/dummy/app/models/image_attached.rb
|
93
|
+
- test/dummy/app/models/private_file_attached.rb
|
94
|
+
- test/dummy/app/models/private_image_attached.rb
|
93
95
|
- test/dummy/app/views/layouts/application.html.erb
|
94
96
|
- test/dummy/bin/bundle
|
95
97
|
- test/dummy/bin/rails
|
@@ -111,12 +113,10 @@ files:
|
|
111
113
|
- test/dummy/config/locales/en.yml
|
112
114
|
- test/dummy/config/routes.rb
|
113
115
|
- test/dummy/config.ru
|
114
|
-
- test/dummy/db/development.sqlite3
|
115
116
|
- test/dummy/db/migrate/20130820222342_create_file_attacheds.rb
|
116
117
|
- test/dummy/db/migrate/20130820222355_create_image_attacheds.rb
|
117
118
|
- test/dummy/db/migrate/20130820222534_create_all_attacheds.rb
|
118
119
|
- test/dummy/db/schema.rb
|
119
|
-
- test/dummy/db/test.sqlite3
|
120
120
|
- test/dummy/log/development.log
|
121
121
|
- test/dummy/log/test.log
|
122
122
|
- test/dummy/public/404.html
|
@@ -135,6 +135,7 @@ files:
|
|
135
135
|
- test/dummy/test/fixtures/image.jpg
|
136
136
|
- test/dummy/test/fixtures/image_big.jpg
|
137
137
|
- test/dummy/test/fixtures/image_empty.jpg
|
138
|
+
- test/dummy/tmp/uploads/files/13898788260004868.txt
|
138
139
|
- test/local_file_record_test.rb
|
139
140
|
- test/local_file_string_test.rb
|
140
141
|
- test/local_file_upload_test.rb
|
@@ -173,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
174
|
version: '0'
|
174
175
|
requirements: []
|
175
176
|
rubyforge_project:
|
176
|
-
rubygems_version: 2.
|
177
|
+
rubygems_version: 2.1.11
|
177
178
|
signing_key:
|
178
179
|
specification_version: 4
|
179
180
|
summary: Attachs for Rails.
|
@@ -185,6 +186,8 @@ test_files:
|
|
185
186
|
- test/dummy/app/models/all_attached.rb
|
186
187
|
- test/dummy/app/models/file_attached.rb
|
187
188
|
- test/dummy/app/models/image_attached.rb
|
189
|
+
- test/dummy/app/models/private_file_attached.rb
|
190
|
+
- test/dummy/app/models/private_image_attached.rb
|
188
191
|
- test/dummy/app/views/layouts/application.html.erb
|
189
192
|
- test/dummy/bin/bundle
|
190
193
|
- test/dummy/bin/rails
|
@@ -206,12 +209,10 @@ test_files:
|
|
206
209
|
- test/dummy/config/locales/en.yml
|
207
210
|
- test/dummy/config/routes.rb
|
208
211
|
- test/dummy/config.ru
|
209
|
-
- test/dummy/db/development.sqlite3
|
210
212
|
- test/dummy/db/migrate/20130820222342_create_file_attacheds.rb
|
211
213
|
- test/dummy/db/migrate/20130820222355_create_image_attacheds.rb
|
212
214
|
- test/dummy/db/migrate/20130820222534_create_all_attacheds.rb
|
213
215
|
- test/dummy/db/schema.rb
|
214
|
-
- test/dummy/db/test.sqlite3
|
215
216
|
- test/dummy/log/development.log
|
216
217
|
- test/dummy/log/test.log
|
217
218
|
- test/dummy/public/404.html
|
@@ -230,6 +231,7 @@ test_files:
|
|
230
231
|
- test/dummy/test/fixtures/image.jpg
|
231
232
|
- test/dummy/test/fixtures/image_big.jpg
|
232
233
|
- test/dummy/test/fixtures/image_empty.jpg
|
234
|
+
- test/dummy/tmp/uploads/files/13898788260004868.txt
|
233
235
|
- test/local_file_record_test.rb
|
234
236
|
- test/local_file_string_test.rb
|
235
237
|
- test/local_file_upload_test.rb
|
Binary file
|
data/test/dummy/db/test.sqlite3
DELETED
Binary file
|