spec_cat 3.1.5 → 3.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +7 -1
- data/lib/spec_cat/matchers/validate_with.rb +8 -3
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6530df4ca13539fa3ce5bf482edd4014cca75c2cfd216fd6725038e25cd1b28d
|
4
|
+
data.tar.gz: 9c4f5ee7a8ba3f9cf7fa3b29dd76835424a299697318a59d98d45f7bdfdfff05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e1c683cf31a3ed677acf3bf762668e6fefa63429a0c6ba84f11a84d4b866c5570b3d2014b085777acc6c6b8bd90e061d7cec0a8505f818398406d6e22feb262
|
7
|
+
data.tar.gz: 14d37f5ad9e9aa9915ef9d58cd77b5700cf84ce801aeee0a53e605b52588e531929f3a86db8fc57e5e4bc01c3c377d951609620e2408c3f742648b2a37ba6de3
|
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
[![Build Status](https://travis-ci.org/schrodingersbox/spec_cat.svg?branch=master)](https://travis-ci.org/schrodingersbox/spec_cat)
|
2
2
|
[![Coverage Status](https://coveralls.io/repos/schrodingersbox/spec_cat/badge.png?branch=master)](https://coveralls.io/r/schrodingersbox/spec_cat?branch=master)
|
3
3
|
[![Code Climate](https://codeclimate.com/github/schrodingersbox/spec_cat.png)](https://codeclimate.com/github/schrodingersbox/spec_cat)
|
4
|
-
[![Dependency Status](https://gemnasium.com/schrodingersbox/spec_cat.png)](https://gemnasium.com/schrodingersbox/spec_cat)
|
5
4
|
[![Gem Version](https://badge.fury.io/rb/spec_cat.png)](http://badge.fury.io/rb/spec_cat)
|
6
5
|
|
7
6
|
# schrodingersbox/spec_cat
|
@@ -12,6 +11,7 @@ This gem contains trivial matchers to make RSpecs a bit more effective and less
|
|
12
11
|
* have_a_spec
|
13
12
|
* include_module
|
14
13
|
* pass_rubocop
|
14
|
+
* validates_with
|
15
15
|
|
16
16
|
It also provides rake commands
|
17
17
|
|
@@ -89,6 +89,12 @@ based on it's exit status.
|
|
89
89
|
|
90
90
|
it('passes Rubocop') { is_expected.to pass_rubocop }
|
91
91
|
|
92
|
+
### validates_with
|
93
|
+
|
94
|
+
`validates_with` confirms that an `ActiveModel::Validator` is being used.
|
95
|
+
|
96
|
+
it('validates numbers') { is_expected.to validate_with(NumberValidator) }
|
97
|
+
|
92
98
|
## Rake Tasks
|
93
99
|
|
94
100
|
### spec_cat:accept
|
@@ -9,6 +9,7 @@
|
|
9
9
|
# end
|
10
10
|
|
11
11
|
RSpec::Matchers.define :validate_with do |expected_validator|
|
12
|
+
|
12
13
|
match do |subject|
|
13
14
|
@validator = subject.class.validators.find do |validator|
|
14
15
|
validator.class == expected_validator
|
@@ -24,19 +25,23 @@ RSpec::Matchers.define :validate_with do |expected_validator|
|
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
28
|
+
def options_message
|
29
|
+
@options.present? ? (' with options ' + @options.to_s) : ''
|
30
|
+
end
|
31
|
+
|
27
32
|
chain :with_options do |options|
|
28
33
|
@options = options
|
29
34
|
end
|
30
35
|
|
31
36
|
description do
|
32
|
-
|
37
|
+
"validates with #{expected}"
|
33
38
|
end
|
34
39
|
|
35
40
|
failure_message do
|
36
|
-
"expected to validate with #{
|
41
|
+
"expected to validate with #{expected}#{options_message}"
|
37
42
|
end
|
38
43
|
|
39
44
|
failure_message_when_negated do
|
40
|
-
"
|
45
|
+
"expected to not validate with #{expected}#{options_message}"
|
41
46
|
end
|
42
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spec_cat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rich Humphrey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -34,14 +34,14 @@ dependencies:
|
|
34
34
|
name: rubocop
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '0'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- - "
|
44
|
+
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
143
|
version: '0'
|
144
144
|
requirements: []
|
145
145
|
rubyforge_project:
|
146
|
-
rubygems_version: 2.6.
|
146
|
+
rubygems_version: 2.7.6.2
|
147
147
|
signing_key:
|
148
148
|
specification_version: 4
|
149
149
|
summary: RSpec support library
|