active_storage_validations 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -1
  3. data/lib/active_storage_validations/aspect_ratio_validator.rb +5 -5
  4. data/lib/active_storage_validations/attached_validator.rb +3 -3
  5. data/lib/active_storage_validations/base_size_validator.rb +4 -4
  6. data/lib/active_storage_validations/content_type_spoof_detector.rb +2 -2
  7. data/lib/active_storage_validations/content_type_validator.rb +20 -12
  8. data/lib/active_storage_validations/dimension_validator.rb +5 -5
  9. data/lib/active_storage_validations/limit_validator.rb +4 -4
  10. data/lib/active_storage_validations/matchers/aspect_ratio_validator_matcher.rb +7 -7
  11. data/lib/active_storage_validations/matchers/attached_validator_matcher.rb +6 -6
  12. data/lib/active_storage_validations/matchers/base_size_validator_matcher.rb +7 -7
  13. data/lib/active_storage_validations/matchers/content_type_validator_matcher.rb +33 -33
  14. data/lib/active_storage_validations/matchers/dimension_validator_matcher.rb +7 -7
  15. data/lib/active_storage_validations/matchers/limit_validator_matcher.rb +7 -7
  16. data/lib/active_storage_validations/matchers/processable_image_validator_matcher.rb +7 -7
  17. data/lib/active_storage_validations/metadata.rb +1 -1
  18. data/lib/active_storage_validations/processable_image_validator.rb +4 -4
  19. data/lib/active_storage_validations/size_validator.rb +1 -1
  20. data/lib/active_storage_validations/total_size_validator.rb +1 -1
  21. data/lib/active_storage_validations/version.rb +1 -1
  22. metadata +15 -15
  23. /data/lib/active_storage_validations/matchers/{concerns → shared}/active_storageable.rb +0 -0
  24. /data/lib/active_storage_validations/matchers/{concerns → shared}/allow_blankable.rb +0 -0
  25. /data/lib/active_storage_validations/matchers/{concerns → shared}/attachable.rb +0 -0
  26. /data/lib/active_storage_validations/matchers/{concerns → shared}/contextable.rb +0 -0
  27. /data/lib/active_storage_validations/matchers/{concerns → shared}/messageable.rb +0 -0
  28. /data/lib/active_storage_validations/matchers/{concerns → shared}/rspecable.rb +0 -0
  29. /data/lib/active_storage_validations/matchers/{concerns → shared}/validatable.rb +0 -0
  30. /data/lib/active_storage_validations/{concerns → shared}/active_storageable.rb +0 -0
  31. /data/lib/active_storage_validations/{concerns → shared}/attachable.rb +0 -0
  32. /data/lib/active_storage_validations/{concerns → shared}/errorable.rb +0 -0
  33. /data/lib/active_storage_validations/{concerns → shared}/loggable.rb +0 -0
  34. /data/lib/active_storage_validations/{concerns → shared}/optionable.rb +0 -0
  35. /data/lib/active_storage_validations/{concerns → shared}/symbolizable.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 435de3a42881b172293cf50bc3edb1e5462f4a0f8346543f14936502abe7a041
4
- data.tar.gz: 6dc253e3b1dcf5ac55ae13bcd4fe9d9cabe39cdf49e0de25cc0f091bfb5c3d1b
3
+ metadata.gz: 6e1145fabe1ee64e7f7033a38c5b1de1114b364e5e2d9eb010628afde0a3e0b3
4
+ data.tar.gz: 497b550e5d98bf96e4398969de34022b8e8f828003a620261909a6d39e349aff
5
5
  SHA512:
6
- metadata.gz: bfd15f884cda85c47ad25c1d7e2ca8423f6d6a9e3e4aadeb415492c3a9830a00b10c611ed0eb0a5866bd12e1c2b61aaa69cfccf3952447c3cd716c07e51780c5
7
- data.tar.gz: 91ab2c226d9657f52f6cc5f289fb8697608954d59d34400042e0521b7e60657e5ac5f256b268eef16fd1ffcd83169f61345ba3e7c9e925d1384d427f10a00bad
6
+ metadata.gz: b671b5b33834ff904de1dea6dca51bfd741eaf2e10d931896a6fc4ff9ff83fc213f1581d59c562a806640cdc7a10537fa5ddb240051152ff38b5933ea7c7dc33
7
+ data.tar.gz: 381da6fbfb0fa544357bc492cfc9535992097ed7118846bae62f1b1953e5058f7b1bbc389ebd0dd8543fb035edaba55cee34a8c73a1b4fa84fc2ffc3e8bf9654
data/README.md CHANGED
@@ -221,7 +221,8 @@ aspect_ratio_is_not: "must be a %{aspect_ratio} image"
221
221
 
222
222
  ### Content type
223
223
  The `content_type_invalid` key has three variables that you can use:
224
- - `content_type` containing the content type of the sent file
224
+ - `content_type` containing the exact content type of the sent file
225
+ - `human_content_type` containing a more user-friendly version of the sent file content type (e.g. 'TXT' for 'text/plain')
225
226
  - `authorized_types` containing the list of authorized content types
226
227
  - `filename` containing the current file name
227
228
 
@@ -436,6 +437,7 @@ Then you can use the matchers with the syntax specified in the RSpec section, ju
436
437
 
437
438
  To run tests in root folder of gem:
438
439
 
440
+ * `BUNDLE_GEMFILE=gemfiles/rails_6_1_4.gemfile bundle exec rake test` to run for Rails 7.0
439
441
  * `BUNDLE_GEMFILE=gemfiles/rails_7_0.gemfile bundle exec rake test` to run for Rails 7.0
440
442
  * `BUNDLE_GEMFILE=gemfiles/rails_7_1.gemfile bundle exec rake test` to run for Rails 7.1
441
443
  * `BUNDLE_GEMFILE=gemfiles/rails_7_2.gemfile bundle exec rake test` to run for Rails 7.2
@@ -444,10 +446,12 @@ To run tests in root folder of gem:
444
446
  Snippet to run in console:
445
447
 
446
448
  ```bash
449
+ BUNDLE_GEMFILE=gemfiles/rails_6_1_4.gemfile bundle
447
450
  BUNDLE_GEMFILE=gemfiles/rails_7_0.gemfile bundle
448
451
  BUNDLE_GEMFILE=gemfiles/rails_7_1.gemfile bundle
449
452
  BUNDLE_GEMFILE=gemfiles/rails_7_2.gemfile bundle
450
453
  BUNDLE_GEMFILE=gemfiles/rails_8_0.gemfile bundle
454
+ BUNDLE_GEMFILE=gemfiles/rails_6_1_4.gemfile bundle exec rake test
451
455
  BUNDLE_GEMFILE=gemfiles/rails_7_0.gemfile bundle exec rake test
452
456
  BUNDLE_GEMFILE=gemfiles/rails_7_1.gemfile bundle exec rake test
453
457
  BUNDLE_GEMFILE=gemfiles/rails_7_2.gemfile bundle exec rake test
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'concerns/active_storageable.rb'
4
- require_relative 'concerns/attachable.rb'
5
- require_relative 'concerns/errorable.rb'
6
- require_relative 'concerns/optionable.rb'
7
- require_relative 'concerns/symbolizable.rb'
3
+ require_relative 'shared/active_storageable'
4
+ require_relative 'shared/attachable'
5
+ require_relative 'shared/errorable'
6
+ require_relative 'shared/optionable'
7
+ require_relative 'shared/symbolizable'
8
8
 
9
9
  module ActiveStorageValidations
10
10
  class AspectRatioValidator < ActiveModel::EachValidator # :nodoc
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'concerns/active_storageable.rb'
4
- require_relative 'concerns/errorable.rb'
5
- require_relative 'concerns/symbolizable.rb'
3
+ require_relative 'shared/active_storageable'
4
+ require_relative 'shared/errorable'
5
+ require_relative 'shared/symbolizable'
6
6
 
7
7
  module ActiveStorageValidations
8
8
  class AttachedValidator < ActiveModel::EachValidator # :nodoc:
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'concerns/active_storageable.rb'
4
- require_relative 'concerns/errorable.rb'
5
- require_relative 'concerns/optionable.rb'
6
- require_relative 'concerns/symbolizable.rb'
3
+ require_relative 'shared/active_storageable'
4
+ require_relative 'shared/errorable'
5
+ require_relative 'shared/optionable'
6
+ require_relative 'shared/symbolizable'
7
7
 
8
8
  module ActiveStorageValidations
9
9
  class BaseSizeValidator < ActiveModel::EachValidator # :nodoc:
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'concerns/attachable'
4
- require_relative 'concerns/loggable'
3
+ require_relative 'shared/attachable'
4
+ require_relative 'shared/loggable'
5
5
  require 'open3'
6
6
 
7
7
  module ActiveStorageValidations
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'concerns/active_storageable.rb'
4
- require_relative 'concerns/attachable.rb'
5
- require_relative 'concerns/errorable.rb'
6
- require_relative 'concerns/optionable.rb'
7
- require_relative 'concerns/symbolizable.rb'
8
- require_relative 'content_type_spoof_detector.rb'
3
+ require_relative 'shared/active_storageable'
4
+ require_relative 'shared/attachable'
5
+ require_relative 'shared/errorable'
6
+ require_relative 'shared/optionable'
7
+ require_relative 'shared/symbolizable'
8
+ require_relative 'content_type_spoof_detector'
9
9
 
10
10
  module ActiveStorageValidations
11
11
  class ContentTypeValidator < ActiveModel::EachValidator # :nodoc:
@@ -63,7 +63,7 @@ module ActiveStorageValidations
63
63
  end
64
64
 
65
65
  def extension_matches_content_type?(record, attribute, attachable)
66
- extension = @attachable_filename.split('.').second
66
+ extension = @attachable_filename.split('.').last
67
67
 
68
68
  possible_extensions = Marcel::TYPE_EXTS[@attachable_content_type]
69
69
  return true if possible_extensions && extension.in?(possible_extensions)
@@ -111,15 +111,23 @@ module ActiveStorageValidations
111
111
  def initialize_and_populate_error_options(options, attachable)
112
112
  errors_options = initialize_error_options(options, attachable)
113
113
  errors_options[:content_type] = @attachable_content_type
114
- errors_options[:authorized_types] = authorized_content_types_to_human_format
114
+ errors_options[:human_content_type] = content_type_to_human_format(@attachable_content_type)
115
+ errors_options[:authorized_types] = content_type_to_human_format(@authorized_content_types)
115
116
  errors_options
116
117
  end
117
118
 
118
- def authorized_content_types_to_human_format
119
- @authorized_content_types
120
- .map do |authorized_content_type|
121
- authorized_content_type.is_a?(Regexp) ? authorized_content_type.source : authorized_content_type.to_s.split('/').last.upcase
119
+ def content_type_to_human_format(content_type)
120
+ Array(content_type)
121
+ .map do |content_type|
122
+ case content_type
123
+ when String, Symbol
124
+ content_type.to_s.match?(/\//) ? Marcel::TYPE_EXTS[content_type.to_s]&.first&.upcase : content_type.upcase
125
+ when Regexp
126
+ content_type.source
127
+ end
122
128
  end
129
+ .flatten
130
+ .compact
123
131
  .join(', ')
124
132
  end
125
133
 
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'concerns/active_storageable.rb'
4
- require_relative 'concerns/attachable.rb'
5
- require_relative 'concerns/errorable.rb'
6
- require_relative 'concerns/optionable.rb'
7
- require_relative 'concerns/symbolizable.rb'
3
+ require_relative 'shared/active_storageable'
4
+ require_relative 'shared/attachable'
5
+ require_relative 'shared/errorable'
6
+ require_relative 'shared/optionable'
7
+ require_relative 'shared/symbolizable'
8
8
 
9
9
  module ActiveStorageValidations
10
10
  class DimensionValidator < ActiveModel::EachValidator # :nodoc
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'concerns/active_storageable.rb'
4
- require_relative 'concerns/errorable.rb'
5
- require_relative 'concerns/optionable.rb'
6
- require_relative 'concerns/symbolizable.rb'
3
+ require_relative 'shared/active_storageable'
4
+ require_relative 'shared/errorable'
5
+ require_relative 'shared/optionable'
6
+ require_relative 'shared/symbolizable'
7
7
 
8
8
  module ActiveStorageValidations
9
9
  class LimitValidator < ActiveModel::EachValidator # :nodoc:
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'concerns/active_storageable.rb'
4
- require_relative 'concerns/allow_blankable.rb'
5
- require_relative 'concerns/attachable.rb'
6
- require_relative 'concerns/contextable.rb'
7
- require_relative 'concerns/messageable.rb'
8
- require_relative 'concerns/rspecable.rb'
9
- require_relative 'concerns/validatable.rb'
3
+ require_relative 'shared/active_storageable'
4
+ require_relative 'shared/allow_blankable'
5
+ require_relative 'shared/attachable'
6
+ require_relative 'shared/contextable'
7
+ require_relative 'shared/messageable'
8
+ require_relative 'shared/rspecable'
9
+ require_relative 'shared/validatable'
10
10
 
11
11
  module ActiveStorageValidations
12
12
  module Matchers
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'concerns/active_storageable.rb'
4
- require_relative 'concerns/attachable.rb'
5
- require_relative 'concerns/contextable.rb'
6
- require_relative 'concerns/messageable.rb'
7
- require_relative 'concerns/rspecable.rb'
8
- require_relative 'concerns/validatable.rb'
3
+ require_relative 'shared/active_storageable'
4
+ require_relative 'shared/attachable'
5
+ require_relative 'shared/contextable'
6
+ require_relative 'shared/messageable'
7
+ require_relative 'shared/rspecable'
8
+ require_relative 'shared/validatable'
9
9
 
10
10
  module ActiveStorageValidations
11
11
  module Matchers
@@ -3,13 +3,13 @@
3
3
  # Big thank you to the paperclip validation matchers:
4
4
  # https://github.com/thoughtbot/paperclip/blob/v6.1.0/lib/paperclip/matchers/validate_attachment_size_matcher.rb
5
5
 
6
- require_relative 'concerns/active_storageable.rb'
7
- require_relative 'concerns/allow_blankable.rb'
8
- require_relative 'concerns/attachable.rb'
9
- require_relative 'concerns/contextable.rb'
10
- require_relative 'concerns/messageable.rb'
11
- require_relative 'concerns/rspecable.rb'
12
- require_relative 'concerns/validatable.rb'
6
+ require_relative 'shared/active_storageable'
7
+ require_relative 'shared/allow_blankable'
8
+ require_relative 'shared/attachable'
9
+ require_relative 'shared/contextable'
10
+ require_relative 'shared/messageable'
11
+ require_relative 'shared/rspecable'
12
+ require_relative 'shared/validatable'
13
13
 
14
14
  module ActiveStorageValidations
15
15
  module Matchers
@@ -3,13 +3,13 @@
3
3
  # Big thank you to the paperclip validation matchers:
4
4
  # https://github.com/thoughtbot/paperclip/blob/v6.1.0/lib/paperclip/matchers/validate_attachment_content_type_matcher.rb
5
5
 
6
- require_relative 'concerns/active_storageable.rb'
7
- require_relative 'concerns/allow_blankable.rb'
8
- require_relative 'concerns/attachable.rb'
9
- require_relative 'concerns/contextable.rb'
10
- require_relative 'concerns/messageable.rb'
11
- require_relative 'concerns/rspecable.rb'
12
- require_relative 'concerns/validatable.rb'
6
+ require_relative 'shared/active_storageable'
7
+ require_relative 'shared/allow_blankable'
8
+ require_relative 'shared/attachable'
9
+ require_relative 'shared/contextable'
10
+ require_relative 'shared/messageable'
11
+ require_relative 'shared/rspecable'
12
+ require_relative 'shared/validatable'
13
13
 
14
14
  module ActiveStorageValidations
15
15
  module Matchers
@@ -32,7 +32,7 @@ module ActiveStorageValidations
32
32
  initialize_messageable
33
33
  initialize_rspecable
34
34
  @attribute_name = attribute_name
35
- @allowed_types = @rejected_types = []
35
+ @allowed_content_types = @rejected_content_types = []
36
36
  end
37
37
 
38
38
  def description
@@ -45,13 +45,13 @@ module ActiveStorageValidations
45
45
  message.join("\n")
46
46
  end
47
47
 
48
- def allowing(*types)
49
- @allowed_types = types.flatten
48
+ def allowing(*content_types)
49
+ @allowed_content_types = content_types.flatten
50
50
  self
51
51
  end
52
52
 
53
- def rejecting(*types)
54
- @rejected_types = types.flatten
53
+ def rejecting(*content_types)
54
+ @rejected_content_types = content_types.flatten
55
55
  self
56
56
  end
57
57
 
@@ -62,21 +62,21 @@ module ActiveStorageValidations
62
62
  is_context_valid? &&
63
63
  is_allowing_blank? &&
64
64
  is_custom_message_valid? &&
65
- all_allowed_types_allowed? &&
66
- all_rejected_types_rejected?
65
+ all_allowed_content_types_allowed? &&
66
+ all_rejected_content_types_rejected?
67
67
  end
68
68
 
69
69
  protected
70
70
 
71
71
  def build_failure_message(message)
72
- if @allowed_types_not_allowed.present?
73
- message << " the following content type#{'s' if @allowed_types.count > 1} should be allowed: :#{@allowed_types.join(", :")}"
74
- message << " but #{pluralize(@allowed_types_not_allowed)} rejected"
72
+ if @allowed_content_types_not_allowed.present?
73
+ message << " the following content type#{'s' if @allowed_content_types.count > 1} should be allowed: :#{@allowed_content_types.join(", :")}"
74
+ message << " but #{pluralize(@allowed_content_types_not_allowed)} rejected"
75
75
  end
76
76
 
77
- if @rejected_types_not_rejected.present?
78
- message << " the following content type#{'s' if @rejected_types.count > 1} should be rejected: :#{@rejected_types.join(", :")}"
79
- message << " but #{pluralize(@rejected_types_not_rejected)} accepted"
77
+ if @rejected_content_types_not_rejected.present?
78
+ message << " the following content type#{'s' if @rejected_content_types.count > 1} should be rejected: :#{@rejected_content_types.join(", :")}"
79
+ message << " but #{pluralize(@rejected_content_types_not_rejected)} accepted"
80
80
  end
81
81
  end
82
82
 
@@ -88,25 +88,25 @@ module ActiveStorageValidations
88
88
  end
89
89
  end
90
90
 
91
- def all_allowed_types_allowed?
92
- @allowed_types_not_allowed ||= @allowed_types.reject { |type| type_allowed?(type) }
93
- @allowed_types_not_allowed.empty?
91
+ def all_allowed_content_types_allowed?
92
+ @allowed_content_types_not_allowed ||= @allowed_content_types.reject { |type| type_allowed?(type) }
93
+ @allowed_content_types_not_allowed.empty?
94
94
  end
95
95
 
96
- def all_rejected_types_rejected?
97
- @rejected_types_not_rejected ||= @rejected_types.select { |type| type_allowed?(type) }
98
- @rejected_types_not_rejected.empty?
96
+ def all_rejected_content_types_rejected?
97
+ @rejected_content_types_not_rejected ||= @rejected_content_types.select { |type| type_allowed?(type) }
98
+ @rejected_content_types_not_rejected.empty?
99
99
  end
100
100
 
101
- def type_allowed?(type)
102
- attach_file_of_type(type)
101
+ def type_allowed?(content_type)
102
+ attach_file_with_content_type(content_type)
103
103
  validate
104
104
  detach_file
105
105
  is_valid?
106
106
  end
107
107
 
108
- def attach_file_of_type(type)
109
- @subject.public_send(@attribute_name).attach(attachment_for(type))
108
+ def attach_file_with_content_type(content_type)
109
+ @subject.public_send(@attribute_name).attach(attachment_for(content_type))
110
110
  end
111
111
 
112
112
  def is_custom_message_valid?
@@ -121,13 +121,13 @@ module ActiveStorageValidations
121
121
  @subject.public_send(@attribute_name).attach(attachment_for('fake/fake'))
122
122
  end
123
123
 
124
- def attachment_for(type)
125
- suffix = type.to_s.split('/').last
124
+ def attachment_for(content_type)
125
+ suffix = Marcel::TYPE_EXTS[content_type.to_s]&.first || 'fake'
126
126
 
127
127
  {
128
128
  io: Tempfile.new('.'),
129
129
  filename: "test.#{suffix}",
130
- content_type: type
130
+ content_type: content_type
131
131
  }
132
132
  end
133
133
 
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'concerns/active_storageable.rb'
4
- require_relative 'concerns/allow_blankable.rb'
5
- require_relative 'concerns/attachable'
6
- require_relative 'concerns/contextable.rb'
7
- require_relative 'concerns/messageable.rb'
8
- require_relative 'concerns/rspecable.rb'
9
- require_relative 'concerns/validatable.rb'
3
+ require_relative 'shared/active_storageable'
4
+ require_relative 'shared/allow_blankable'
5
+ require_relative 'shared/attachable'
6
+ require_relative 'shared/contextable'
7
+ require_relative 'shared/messageable'
8
+ require_relative 'shared/rspecable'
9
+ require_relative 'shared/validatable'
10
10
 
11
11
  module ActiveStorageValidations
12
12
  module Matchers
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'concerns/active_storageable'
4
- require_relative 'concerns/allow_blankable'
5
- require_relative 'concerns/attachable'
6
- require_relative 'concerns/contextable'
7
- require_relative 'concerns/messageable'
8
- require_relative 'concerns/rspecable'
9
- require_relative 'concerns/validatable'
3
+ require_relative 'shared/active_storageable'
4
+ require_relative 'shared/allow_blankable'
5
+ require_relative 'shared/attachable'
6
+ require_relative 'shared/contextable'
7
+ require_relative 'shared/messageable'
8
+ require_relative 'shared/rspecable'
9
+ require_relative 'shared/validatable'
10
10
 
11
11
  module ActiveStorageValidations
12
12
  module Matchers
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'concerns/active_storageable.rb'
4
- require_relative 'concerns/allow_blankable.rb'
5
- require_relative 'concerns/attachable.rb'
6
- require_relative 'concerns/contextable.rb'
7
- require_relative 'concerns/messageable.rb'
8
- require_relative 'concerns/rspecable.rb'
9
- require_relative 'concerns/validatable.rb'
3
+ require_relative 'shared/active_storageable'
4
+ require_relative 'shared/allow_blankable'
5
+ require_relative 'shared/attachable'
6
+ require_relative 'shared/contextable'
7
+ require_relative 'shared/messageable'
8
+ require_relative 'shared/rspecable'
9
+ require_relative 'shared/validatable'
10
10
 
11
11
  module ActiveStorageValidations
12
12
  module Matchers
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'concerns/loggable'
3
+ require_relative 'shared/loggable'
4
4
 
5
5
  module ActiveStorageValidations
6
6
  class Metadata
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'concerns/active_storageable.rb'
4
- require_relative 'concerns/attachable.rb'
5
- require_relative 'concerns/errorable.rb'
6
- require_relative 'concerns/symbolizable.rb'
3
+ require_relative 'shared/active_storageable'
4
+ require_relative 'shared/attachable'
5
+ require_relative 'shared/errorable'
6
+ require_relative 'shared/symbolizable'
7
7
 
8
8
  module ActiveStorageValidations
9
9
  class ProcessableImageValidator < ActiveModel::EachValidator # :nodoc
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'base_size_validator.rb'
3
+ require_relative 'base_size_validator'
4
4
 
5
5
  module ActiveStorageValidations
6
6
  class SizeValidator < BaseSizeValidator
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'base_size_validator.rb'
3
+ require_relative 'base_size_validator'
4
4
 
5
5
  module ActiveStorageValidations
6
6
  class TotalSizeValidator < BaseSizeValidator
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveStorageValidations
4
- VERSION = '1.3.1'
4
+ VERSION = '1.3.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: 1.3.1
4
+ version: 1.3.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: 2024-11-08 00:00:00.000000000 Z
11
+ date: 2024-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob
@@ -262,12 +262,6 @@ files:
262
262
  - lib/active_storage_validations/aspect_ratio_validator.rb
263
263
  - lib/active_storage_validations/attached_validator.rb
264
264
  - lib/active_storage_validations/base_size_validator.rb
265
- - lib/active_storage_validations/concerns/active_storageable.rb
266
- - lib/active_storage_validations/concerns/attachable.rb
267
- - lib/active_storage_validations/concerns/errorable.rb
268
- - lib/active_storage_validations/concerns/loggable.rb
269
- - lib/active_storage_validations/concerns/optionable.rb
270
- - lib/active_storage_validations/concerns/symbolizable.rb
271
265
  - lib/active_storage_validations/content_type_spoof_detector.rb
272
266
  - lib/active_storage_validations/content_type_validator.rb
273
267
  - lib/active_storage_validations/dimension_validator.rb
@@ -278,22 +272,28 @@ files:
278
272
  - lib/active_storage_validations/matchers/aspect_ratio_validator_matcher.rb
279
273
  - lib/active_storage_validations/matchers/attached_validator_matcher.rb
280
274
  - lib/active_storage_validations/matchers/base_size_validator_matcher.rb
281
- - lib/active_storage_validations/matchers/concerns/active_storageable.rb
282
- - lib/active_storage_validations/matchers/concerns/allow_blankable.rb
283
- - lib/active_storage_validations/matchers/concerns/attachable.rb
284
- - lib/active_storage_validations/matchers/concerns/contextable.rb
285
- - lib/active_storage_validations/matchers/concerns/messageable.rb
286
- - lib/active_storage_validations/matchers/concerns/rspecable.rb
287
- - lib/active_storage_validations/matchers/concerns/validatable.rb
288
275
  - lib/active_storage_validations/matchers/content_type_validator_matcher.rb
289
276
  - lib/active_storage_validations/matchers/dimension_validator_matcher.rb
290
277
  - lib/active_storage_validations/matchers/limit_validator_matcher.rb
291
278
  - lib/active_storage_validations/matchers/processable_image_validator_matcher.rb
279
+ - lib/active_storage_validations/matchers/shared/active_storageable.rb
280
+ - lib/active_storage_validations/matchers/shared/allow_blankable.rb
281
+ - lib/active_storage_validations/matchers/shared/attachable.rb
282
+ - lib/active_storage_validations/matchers/shared/contextable.rb
283
+ - lib/active_storage_validations/matchers/shared/messageable.rb
284
+ - lib/active_storage_validations/matchers/shared/rspecable.rb
285
+ - lib/active_storage_validations/matchers/shared/validatable.rb
292
286
  - lib/active_storage_validations/matchers/size_validator_matcher.rb
293
287
  - lib/active_storage_validations/matchers/total_size_validator_matcher.rb
294
288
  - lib/active_storage_validations/metadata.rb
295
289
  - lib/active_storage_validations/processable_image_validator.rb
296
290
  - lib/active_storage_validations/railtie.rb
291
+ - lib/active_storage_validations/shared/active_storageable.rb
292
+ - lib/active_storage_validations/shared/attachable.rb
293
+ - lib/active_storage_validations/shared/errorable.rb
294
+ - lib/active_storage_validations/shared/loggable.rb
295
+ - lib/active_storage_validations/shared/optionable.rb
296
+ - lib/active_storage_validations/shared/symbolizable.rb
297
297
  - lib/active_storage_validations/size_validator.rb
298
298
  - lib/active_storage_validations/total_size_validator.rb
299
299
  - lib/active_storage_validations/version.rb