active_storage_validations 1.1.0 → 1.1.1

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: f41ec7bce11523af0deebbac7aac427c19a0c5f9788c3719ff94122468781a79
4
- data.tar.gz: aef955507fb8c8b3a42a27820ea213347f03c49373eef27b44a99e764456b77d
3
+ metadata.gz: 3b512ecda0ff1fa0f06649f78b7b4f58433ca7f108abd729ce08cd0eea2b1baf
4
+ data.tar.gz: 1ef72d050d31ed0d4052672370849c5d66538df5b06e5a477ebc3575fc110e40
5
5
  SHA512:
6
- metadata.gz: 19b37c9826cda8b8864631c77e5a3eabf1f8164279ad2c64beebd5f60b82e03dc39bdb466d516fa161b81b9ca3b0d98913bd04b32950e3b98b3ab28632941a91
7
- data.tar.gz: d12ffa26482ae3e3feead8c3b658f0aa4331dd08a16b87ba9d7e639bc78a25499bda8ba27ae81c0db39d7d0c9bd59bc9f136b56500d97ae5a0f8b2bd85a5f112
6
+ metadata.gz: dc0392b8725f2a567df3f99b61c5053ab0870e877ba16f3085871842a70ca7f5db328b63b3275912017831d4ed29697a66106cdad4e7cfbb779a1985b7d20488
7
+ data.tar.gz: 8a6883ac4f1cbf0e703c41d1e8ddf6136397fb3973997cc37c83aef3f0456ab5278b5475518ce3ddb8a776a41c8e8f7774160850ddcb49b5ece6e9c846cab8db
@@ -35,7 +35,7 @@ module ActiveStorageValidations
35
35
 
36
36
  def matches?(subject)
37
37
  @subject = subject.is_a?(Class) ? subject.new : subject
38
- responds_to_methods && allowed_types_allowed? && rejected_types_rejected? && validate_error_message?
38
+ responds_to_methods && allowed_types_allowed? && rejected_types_rejected? && validate_custom_message?
39
39
  end
40
40
 
41
41
  def failure_message
@@ -88,10 +88,12 @@ module ActiveStorageValidations
88
88
  end
89
89
  end
90
90
 
91
- def validate_error_message?
91
+ def validate_custom_message?
92
+ return true unless @custom_message
93
+
92
94
  @subject.public_send(@attribute_name).attach(attachment_for('fake/fake'))
93
95
  @subject.validate
94
- @subject.errors.details[@attribute_name].all? do |error|
96
+ @subject.errors.details[@attribute_name].select{|error| error[:content_type]}.all? do |error|
95
97
  error[:error].to_s.include?(error_message)
96
98
  end
97
99
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveStorageValidations
4
- VERSION = '1.1.0'
4
+ VERSION = '1.1.1'
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.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Kasyanchuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-24 00:00:00.000000000 Z
11
+ date: 2023-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob