rails_uploads 0.2.5 → 0.2.6
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.
- data/README.rdoc +8 -5
- data/config/locales/en.yml +8 -0
- data/config/locales/es.yml +8 -0
- data/lib/rails_uploads/active_record/base.rb +7 -2
- data/lib/rails_uploads/magick/image.rb +1 -1
- data/lib/rails_uploads/types/file.rb +4 -4
- data/lib/rails_uploads/validators/attachment_content_type_validator.rb +1 -1
- data/lib/rails_uploads/validators/attachment_size_validator.rb +5 -4
- data/lib/rails_uploads/version.rb +1 -1
- data/test/dummy/config/locales/en.yml +0 -7
- data/test/dummy/log/test.log +1077 -0
- data/test/unit/local_validators_test.rb +5 -4
- metadata +4 -2
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class LocalValidatorsTest < ActiveSupport::TestCase
|
4
|
+
include ActionView::Helpers::NumberHelper
|
4
5
|
|
5
6
|
setup do
|
6
7
|
@record = ValidationUpload.new
|
@@ -28,11 +29,11 @@ class LocalValidatorsTest < ActiveSupport::TestCase
|
|
28
29
|
test "should check the file size" do
|
29
30
|
@record.file_size = fixture_file_upload('/file_big.txt', 'text/plain')
|
30
31
|
assert !@record.valid?
|
31
|
-
assert_equal [I18n.t('errors.messages.attachment_size_less_than', :
|
32
|
+
assert_equal [I18n.t('errors.messages.attachment_size_less_than', :count => number_to_human_size(15.kilobytes))], @record.errors[:file_size]
|
32
33
|
|
33
34
|
@record.file_size = fixture_file_upload('/file_empty.txt', 'text/plain')
|
34
35
|
assert !@record.valid?
|
35
|
-
assert_equal [I18n.t('errors.messages.attachment_size_greater_than', :
|
36
|
+
assert_equal [I18n.t('errors.messages.attachment_size_greater_than', :count => number_to_human_size(10.bytes))], @record.errors[:file_size]
|
36
37
|
|
37
38
|
@record.file_size = fixture_file_upload('/file.txt', 'text/plain')
|
38
39
|
assert !@record.valid?
|
@@ -40,11 +41,11 @@ class LocalValidatorsTest < ActiveSupport::TestCase
|
|
40
41
|
|
41
42
|
@record.image_size = fixture_file_upload('/image_big.jpg', 'image/jpeg')
|
42
43
|
assert !@record.valid?
|
43
|
-
assert_equal [I18n.t('errors.messages.attachment_size_in', :
|
44
|
+
assert_equal [I18n.t('errors.messages.attachment_size_in', :min => number_to_human_size(2.kilobytes), :max => number_to_human_size(60.kilobytes))], @record.errors[:image_size]
|
44
45
|
|
45
46
|
@record.image_size = fixture_file_upload('/image_empty.jpg', 'image/jpeg')
|
46
47
|
assert !@record.valid?
|
47
|
-
assert_equal [I18n.t('errors.messages.attachment_size_in', :
|
48
|
+
assert_equal [I18n.t('errors.messages.attachment_size_in', :min => number_to_human_size(2.kilobytes), :max => number_to_human_size(60.kilobytes))], @record.errors[:image_size]
|
48
49
|
|
49
50
|
@record.image_size = fixture_file_upload('/image.jpg', 'image/jpeg')
|
50
51
|
assert !@record.valid?
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_uploads
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -68,6 +68,8 @@ extra_rdoc_files: []
|
|
68
68
|
files:
|
69
69
|
- app/controllers/rails_uploads/application_controller.rb
|
70
70
|
- app/controllers/rails_uploads/presets_controller.rb
|
71
|
+
- config/locales/en.yml
|
72
|
+
- config/locales/es.yml
|
71
73
|
- config/routes.rb
|
72
74
|
- lib/generators/uploads/s3/config_generator.rb
|
73
75
|
- lib/generators/uploads/s3/templates/s3.yml
|