validator-matchers 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/lib/validator/matchers/model_spec_helper.rb +9 -5
- data/lib/validator/matchers/version.rb +1 -1
- data/lib/validator/matchers.rb +2 -2
- data/validator-matchers.gemspec +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c1f7d659b11c8a188407299f5af2e5d526e7eccb7686bfdf35720011d535b16
|
4
|
+
data.tar.gz: 4c9b263f69806510b62bddd94f912a8ed11014921b34c334cd787709f72f44cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e44b48ef54dc811dca0613351d61e4b1332e43e1f9744e0ff0fe50e8e1d9851102f9c8f72b81b152909cb5c7d52f746328be5209da404cae4dc660239a7cd09
|
7
|
+
data.tar.gz: 72833b305492ac2a31664016bea2bede4d89e9ecef85429ac91fe60124997b9301de04ca6f70be7cf4ad8ec8e5a3406ecb42d0481f201a3f905bac7a60c918a8
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,14 @@ Historical changelog for all versions.
|
|
4
4
|
|
5
5
|
## HEAD
|
6
6
|
|
7
|
+
## v0.0.4
|
8
|
+
|
9
|
+
* Update RSpec version lock to allow for Rails 7.1 support [#1](https://github.com/joshbuker/validator-matchers/pull/1)
|
10
|
+
|
11
|
+
## v0.0.3
|
12
|
+
|
13
|
+
* Fix dynamic validator not allowing different attributes
|
14
|
+
|
7
15
|
## v0.0.2
|
8
16
|
|
9
17
|
* Add respond_to_missing? method to ModelSpecHelper
|
@@ -11,7 +19,7 @@ Historical changelog for all versions.
|
|
11
19
|
|
12
20
|
## v0.0.1
|
13
21
|
|
14
|
-
*
|
22
|
+
* Add initial ModelSpecHelper, needs further testing and code cleanup
|
15
23
|
|
16
24
|
## v0.0.0
|
17
25
|
|
@@ -15,25 +15,29 @@ module Validator
|
|
15
15
|
validator_name = regex[1]
|
16
16
|
validator_class_name = validator_name.camelcase + 'Validator'
|
17
17
|
|
18
|
-
RSpec::Matchers.define method_name do |
|
18
|
+
RSpec::Matchers.define method_name do |attribute|
|
19
19
|
match do |model|
|
20
|
+
attribute = attribute.first if attribute.is_a?(Array)
|
20
21
|
model_validators =
|
21
|
-
model._validators[
|
22
|
+
model._validators[attribute].map{ |v| v.class.to_s }
|
22
23
|
model_validators.include?(validator_class_name)
|
23
24
|
end
|
24
25
|
|
25
26
|
failure_message do |model|
|
27
|
+
attribute = attribute.first if attribute.is_a?(Array)
|
26
28
|
model.class.to_s + ' does not ' +
|
27
|
-
method_name.to_s.humanize.downcase + ' :' +
|
29
|
+
method_name.to_s.humanize.downcase + ' :' + attribute.to_s
|
28
30
|
end
|
29
31
|
|
30
32
|
failure_message_when_negated do |model|
|
33
|
+
attribute = attribute.first if attribute.is_a?(Array)
|
31
34
|
model.class.to_s + ' does ' +
|
32
|
-
method_name.to_s.humanize.downcase + ' :' +
|
35
|
+
method_name.to_s.humanize.downcase + ' :' + attribute.to_s
|
33
36
|
end
|
34
37
|
|
35
38
|
description do |model|
|
36
|
-
|
39
|
+
attribute = attribute.first if attribute.is_a?(Array)
|
40
|
+
method_name.to_s.humanize.downcase + ' :' + attribute.to_s
|
37
41
|
end
|
38
42
|
end
|
39
43
|
|
data/lib/validator/matchers.rb
CHANGED
@@ -2,9 +2,9 @@ require 'rspec/core'
|
|
2
2
|
|
3
3
|
module Validator
|
4
4
|
module Matchers
|
5
|
-
autoload :
|
6
|
-
autoload :ModelSpecHelper, 'validator/matchers/model_spec_helper'
|
5
|
+
autoload :ModelSpecHelper, 'validator/matchers/model_spec_helper'
|
7
6
|
autoload :ValidatorSpecHelper, 'validator/matchers/validator_spec_helper'
|
7
|
+
autoload :VERSION, 'validator/matchers/version'
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
data/validator-matchers.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: validator-matchers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Buker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-rails
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '3.0'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '7'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '3.0'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '7'
|
33
33
|
description:
|
34
34
|
email: crypto@joshbuker.com
|
35
35
|
executables: []
|
@@ -51,9 +51,9 @@ licenses:
|
|
51
51
|
- MIT
|
52
52
|
metadata:
|
53
53
|
bug_tracker_uri: https://github.com/athix/validator-matchers/issues
|
54
|
-
changelog_uri: https://github.com/athix/validator-matchers/releases/tag/v0.0.
|
54
|
+
changelog_uri: https://github.com/athix/validator-matchers/releases/tag/v0.0.4
|
55
55
|
documentation_uri: https://rubydoc.info/gems/validator-matchers
|
56
|
-
source_code_uri: https://github.com/athix/validator-matchers/tree/v0.0.
|
56
|
+
source_code_uri: https://github.com/athix/validator-matchers/tree/v0.0.4
|
57
57
|
post_install_message:
|
58
58
|
rdoc_options: []
|
59
59
|
require_paths:
|
@@ -69,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
requirements: []
|
72
|
-
rubygems_version: 3.
|
72
|
+
rubygems_version: 3.3.5
|
73
73
|
signing_key:
|
74
74
|
specification_version: 4
|
75
75
|
summary: RSpec matchers for your custom validator unit testing
|