validator-matchers 0.0.2 → 0.0.3
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 +4 -4
- data/CHANGELOG.md +5 -1
- data/lib/validator/matchers.rb +2 -2
- data/lib/validator/matchers/model_spec_helper.rb +9 -5
- data/lib/validator/matchers/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 493186123992690fea3b54115bcc1c31afbeb4a44b078d576e1659f7395f3795
|
4
|
+
data.tar.gz: 6034275eface3a9ba31b52487118d4a3c2a1c17a236e1e88e5d32e4b61612d00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8387dfa37a304bd26dfbb10a89e54c2abe9e78057952444a66d550322850b705c3e5c7d630e4c156e9c14ad1ab975739ae0e5fd1b1bc5b9c0db32921388fadb1
|
7
|
+
data.tar.gz: 16b4fdc9813adb2e414b00255713216dd731642cbcfef963b35a6ea95efb95a26cace5c0e5892de381053fe6c8b731967d622bb2ca04c0b9bdc994031951c7ba
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,10 @@ Historical changelog for all versions.
|
|
4
4
|
|
5
5
|
## HEAD
|
6
6
|
|
7
|
+
## v0.0.3
|
8
|
+
|
9
|
+
* Fix dynamic validator not allowing different attributes
|
10
|
+
|
7
11
|
## v0.0.2
|
8
12
|
|
9
13
|
* Add respond_to_missing? method to ModelSpecHelper
|
@@ -11,7 +15,7 @@ Historical changelog for all versions.
|
|
11
15
|
|
12
16
|
## v0.0.1
|
13
17
|
|
14
|
-
*
|
18
|
+
* Add initial ModelSpecHelper, needs further testing and code cleanup
|
15
19
|
|
16
20
|
## v0.0.0
|
17
21
|
|
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
|
|
@@ -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
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Buker
|
@@ -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.3
|
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.3
|
57
57
|
post_install_message:
|
58
58
|
rdoc_options: []
|
59
59
|
require_paths:
|