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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 439c18f7d1952192bf309d571c0f8b8a36d75409bc7f3cdafcad6c765387a198
4
- data.tar.gz: dbb77ae1dab7d97d995b4c5dae464506453cfd302a4aa7355aa3bc6b88ed3a4a
3
+ metadata.gz: 2c1f7d659b11c8a188407299f5af2e5d526e7eccb7686bfdf35720011d535b16
4
+ data.tar.gz: 4c9b263f69806510b62bddd94f912a8ed11014921b34c334cd787709f72f44cb
5
5
  SHA512:
6
- metadata.gz: 2cac5a39393a8c6fa6ace485a8c1163bd8e3e0b7838cdbe0cc60615f865b59328e817e35b04c28f37479e01db7574c2845c0f7144282e8a8d8c7a30138116500
7
- data.tar.gz: c87a2bc3961aae7197e113546f0bcd263be587285c37a1321a44430e7a44dcc4564dd90fa1acc71710fa842142362e099b1643203a264c21c8d9882c8d8e1b80
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
- * Added initial model spec helpers, needs further testing and code cleanup
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 |dynamic_matcher|
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[args.first].map{ |v| v.class.to_s }
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 + ' :' + args.first.to_s
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 + ' :' + args.first.to_s
35
+ method_name.to_s.humanize.downcase + ' :' + attribute.to_s
33
36
  end
34
37
 
35
38
  description do |model|
36
- method_name.to_s.humanize.downcase + ' :' + args.first.to_s
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
 
@@ -7,7 +7,7 @@ module Validator
7
7
  module VERSION
8
8
  MAJOR = 0
9
9
  MINOR = 0
10
- PATCH = 2
10
+ PATCH = 4
11
11
 
12
12
  STRING = [MAJOR, MINOR, PATCH].join('.')
13
13
  end
@@ -2,9 +2,9 @@ require 'rspec/core'
2
2
 
3
3
  module Validator
4
4
  module Matchers
5
- autoload :VERSION, 'validator/matchers/version'
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
 
@@ -34,5 +34,5 @@ Gem::Specification.new do |s|
34
34
 
35
35
  s.require_paths = ['lib']
36
36
 
37
- s.add_dependency 'rspec-rails', '>= 3.0', '< 6'
37
+ s.add_dependency 'rspec-rails', '>= 3.0', '< 7'
38
38
  end
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.2
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: 2021-04-25 00:00:00.000000000 Z
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: '6'
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: '6'
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.2
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.2
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.1.2
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