spec_cat 3.1.4 → 3.1.7

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
- SHA1:
3
- metadata.gz: 5634a25c20392048bac0d22477f066517dfd3075
4
- data.tar.gz: 1ddf8bc14d0b9155da6a960cfe2c9c78d7df2a5f
2
+ SHA256:
3
+ metadata.gz: 69afa882dbd40f867392c266021031937652581e9689c014516d4aed77e503cf
4
+ data.tar.gz: ef74319d79b13b9af1c89d395c38969922548d79db888ac46a411d054e27fd48
5
5
  SHA512:
6
- metadata.gz: 6e4fe0f1cd4594857b928a042b4a516aac37fc72c945d6762194e7f1e5aa6a4bbac33b43168b2fa7301c5ae43a393bec7015aff06989f8a167753181181d10d8
7
- data.tar.gz: b2c214031cdac240cf7f20befe71c0d6dd5d00514b82dcfd88a0ac02fd2a9f357991dee5ab990fc24a54fab6993c6b978d35d3363bbf6648f532128cd719bb3d
6
+ metadata.gz: a30433a652f2ab0f7cb177ba4587b4da220b91c0f23188f109dd74926392fc73ebd7b9cfdffb245df68be2fd5a4e7c78948dae8bb498256ba2f2900eb5259abb
7
+ data.tar.gz: 711209fda4dc8497dac3ec4d433e5f2d3d0b534dcfaa2cd7ba9e8467d70d5e04a6f2b19996d27ada418a9bc1bc068883c4946cce56b0420b3dfe0f713d71c7fd
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
- 'RSpec matcher for validates_with'
37
+ "validates with #{expected}"
33
38
  end
34
39
 
35
40
  failure_message do
36
- "expected to validate with #{@validator}#{@options.present? ? (' with options ' + @options) : ''}"
41
+ "expected to validate with #{expected}#{options_message}"
37
42
  end
38
43
 
39
44
  failure_message_when_negated do
40
- "do not expected to validate with #{@validator}#{@options.present? ? (' with options ' + @options) : ''}"
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
4
+ version: 3.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rich Humphrey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-29 00:00:00.000000000 Z
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.11
146
+ rubygems_version: 2.7.6.2
147
147
  signing_key:
148
148
  specification_version: 4
149
149
  summary: RSpec support library