active_storage_validations 0.9.1 → 0.9.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0475512c246a633adcc226c575f66826ffa09df688fda330f2b862d7229a3e3a
4
- data.tar.gz: c52cbf3aa8527ddfc7e17f8619d63f1f3b008360e969f054a129d8e0f6af2e51
3
+ metadata.gz: 6e8b30d036f53b6e00b209c9fe9a34339ff23aa35b789da9585df7fee6c8dfad
4
+ data.tar.gz: 0655072452aa29e24bcea5abb01e6b72bf6ddee6f2646d92eb8b13dbaeff128f
5
5
  SHA512:
6
- metadata.gz: f472fa75d9d021f8ab55bff5dd900d738449884f9bf6ee72d953bb34c988acf01904c29dca7586f5d82ad192b9914bfd9e6f365d413615ef1b3aa18b9635cbb1
7
- data.tar.gz: 8f1b3da90613ff72ab85aaa6faf6fe7403b132e1806c2e4f60156cf95d9f9dfd1dac20d950c7eb0cda64229427deb51d1ce2e4b1742020040c78853c8cdc1bba
6
+ metadata.gz: 8df0893d2048e22d55660f590a747d55b2fff2595bae0f7da8b9151079d2c87e7d09a5e3059529a9fd9ef1231e44b4e9c610d3d22c9da5bfc8e49eb3aa0d25ca
7
+ data.tar.gz: a55c3ba3ff97b5478061fc8a8307127231dbbbb64f49fdcaccea85e6c896e48e777b30e09c97d44b9d84d61b8b5c4ef6abdb843171120b1ae739b38ebf916fb2
data/README.md CHANGED
@@ -4,8 +4,6 @@ If you are using `active_storage` gem and you want to add simple validations for
4
4
 
5
5
  This gems doing it for you. Just use `attached: true` or `content_type: 'image/png'` validation.
6
6
 
7
- [![Build Status](https://travis-ci.org/igorkasyanchuk/active_storage_validations.svg?branch=master)](https://travis-ci.org/igorkasyanchuk/active_storage_validations)
8
-
9
7
  ## What it can do
10
8
 
11
9
  * validates if file(s) attached
@@ -287,9 +285,7 @@ To run tests in root folder of gem:
287
285
 
288
286
  * `BUNDLE_GEMFILE=gemfiles/rails_5_2.gemfile bundle exec rake test` to run for Rails 5.2
289
287
  * `BUNDLE_GEMFILE=gemfiles/rails_6_0.gemfile bundle exec rake test` to run for Rails 6.0
290
- * `BUNDLE_GEMFILE=gemfiles/rails_6_1.gemfile bundle exec rake test` to run for Rails 6.1 (TESTS ARE NOT READY, migration in DB is needed for specs)
291
-
292
- To play with app `cd test/dummy` and `rails s -b 0.0.0.0` (before `rails db:migrate`).
288
+ * `BUNDLE_GEMFILE=gemfiles/rails_6_1.gemfile bundle exec rake test` to run for Rails 6.1
293
289
 
294
290
  ## Known issues
295
291
 
@@ -52,7 +52,7 @@ module ActiveStorageValidations
52
52
  # Rails 5
53
53
  def validate_each(record, attribute, _value)
54
54
  return true unless record.send(attribute).attached?
55
-
55
+
56
56
  files = Array.wrap(record.send(attribute))
57
57
  files.each do |file|
58
58
  # Analyze file first if not analyzed to get all required metadata.
@@ -110,7 +110,7 @@ module ActiveStorageValidations
110
110
  else
111
111
  if file_metadata[length] != options[length]
112
112
  add_error(record, attribute, options[:message].presence || :"dimension_#{length}_equal_to", length: options[length])
113
- return false
113
+ return false
114
114
  end
115
115
  end
116
116
  end
@@ -119,10 +119,10 @@ module ActiveStorageValidations
119
119
  true # valid file
120
120
  end
121
121
 
122
- def add_error(record, attribute, type, *attrs)
122
+ def add_error(record, attribute, type, **attrs)
123
123
  key = options[:message].presence || type
124
124
  return if record.errors.added?(attribute, key)
125
- record.errors.add(attribute, key, *attrs)
125
+ record.errors.add(attribute, key, **attrs)
126
126
  end
127
127
 
128
128
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveStorageValidations
4
- VERSION = '0.9.1'
4
+ VERSION = '0.9.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_storage_validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Kasyanchuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-28 00:00:00.000000000 Z
11
+ date: 2021-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 5.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: combustion
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: mini_magick
29
43
  requirement: !ruby/object:Gem::Requirement