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.
@@ -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', :less_than => 15.kilobytes)], @record.errors[:file_size]
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', :greater_than => 10.bytes)], @record.errors[:file_size]
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', :greater_than => 2.kilobytes, :less_than => 60.kilobytes)], @record.errors[:image_size]
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', :greater_than => 2.kilobytes, :less_than => 60.kilobytes)], @record.errors[:image_size]
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.5
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-03 00:00:00.000000000 Z
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