rspec-be_valid_when_matcher 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/rspec/be_valid_when_matcher.rb +9 -1
- data/spec/examples.cache +108 -103
- data/spec/rspec/be_valid_when/is_type_spec.rb +14 -2
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b80bc4ac78d86e5f92bf0c2c58d6ca855c97b6b
|
4
|
+
data.tar.gz: 62559b46e1d71150a641fbd6ea6e5ba041da44b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e7c4e9d13002ca86fd4a15e99749dd0c433c5655d11d6a88ac4c87904c50c59b0d040e0fd660beb7ad2a4fde1045edb4315053279741a007b618890351eb1b5
|
7
|
+
data.tar.gz: 772dd5127e54b55e287de053e827a37a44666a5d88a4b0bde164bd062a2f35a97f6d49f0e4405db605a1cf7ea1cd0fab0455e9c98956b1e59a47230023c8236f
|
data/README.md
CHANGED
@@ -130,6 +130,7 @@ be_valid_when(:field).is_regexp # Defaults to /^value$/
|
|
130
130
|
be_valid_when(:field).is_array # Defaults to [42]
|
131
131
|
be_valid_when(:field).is_hash # Defaults to { value: 42 }
|
132
132
|
be_valid_when(:field).is_symbol # Defaults to :value
|
133
|
+
be_valid_when(:field).is_range # Defaults to 2..42
|
133
134
|
```
|
134
135
|
|
135
136
|
### Boolean values
|
@@ -121,7 +121,8 @@ module RSpec
|
|
121
121
|
regexp: { value: /^value$/, type: Regexp },
|
122
122
|
array: { value: [42], type: Array },
|
123
123
|
hash: { value: { value: 42 }, type: Hash },
|
124
|
-
symbol: { value: :value, type: Symbol }
|
124
|
+
symbol: { value: :value, type: Symbol },
|
125
|
+
range: { value: 2..42, type: Range } }.each do |name, properties|
|
125
126
|
define_method "is_#{name}" do |value = properties[:value]|
|
126
127
|
fail ArgumentError, "should be #{name}" unless value.is_a? properties[:type]
|
127
128
|
|
@@ -334,6 +335,13 @@ module RSpec
|
|
334
335
|
# it { is_expected.to be_valid_when(:field).is_symbol }
|
335
336
|
# @return [self]
|
336
337
|
|
338
|
+
# @!method is_range(value = 2..42)
|
339
|
+
# Setup matcher for checking range values.
|
340
|
+
# @raise [ArgumentError] if given non `Range` value.
|
341
|
+
# @example
|
342
|
+
# it { is_expected.to be_valid_when(:field).is_range }
|
343
|
+
# @return [self]
|
344
|
+
|
337
345
|
# @!endgroup
|
338
346
|
|
339
347
|
# @!group Logical value
|
data/spec/examples.cache
CHANGED
@@ -1,114 +1,119 @@
|
|
1
1
|
example_id | status | run_time |
|
2
2
|
------------------------------------------------------ | ------ | --------------- |
|
3
|
-
./spec/rspec/be_valid_when/is_not_present_spec.rb[1:1] | passed | 0.
|
4
|
-
./spec/rspec/be_valid_when/is_not_present_spec.rb[1:2] | passed | 0.
|
5
|
-
./spec/rspec/be_valid_when/is_not_present_spec.rb[1:3] | passed | 0.
|
6
|
-
./spec/rspec/be_valid_when/is_spec.rb[1:1] | passed | 0.
|
7
|
-
./spec/rspec/be_valid_when/is_spec.rb[1:2:1] | passed | 0.
|
8
|
-
./spec/rspec/be_valid_when/is_spec.rb[1:3:1] | passed | 0.
|
9
|
-
./spec/rspec/be_valid_when/is_spec.rb[1:3:2] | passed | 0.
|
10
|
-
./spec/rspec/be_valid_when/is_spec.rb[1:4] | passed | 0.
|
11
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:1:1:1] | passed | 0.
|
12
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:1:1:2] | passed | 0.
|
13
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:1:2:1] | passed | 0.
|
14
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:1:2:2] | passed | 0.
|
15
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:1:2:3] | passed | 0.
|
16
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:2:1:1] | passed | 0.
|
17
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:2:1:2] | passed | 0.
|
18
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:2:2:1] | passed | 0.
|
19
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:2:2:2] | passed | 0.
|
20
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:2:2:3] | passed | 0.
|
21
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:3:1:1] | passed | 0.
|
22
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:3:1:2] | passed | 0.
|
23
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:3:2:1] | passed | 0.
|
24
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:3:2:2] | passed | 0.
|
25
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:3:2:3] | passed | 0.
|
26
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:4:1:1] | passed | 0.
|
27
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:4:1:2] | passed | 0.
|
28
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:4:2:1] | passed | 0.
|
29
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:4:2:2] | passed | 0.
|
30
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:4:2:3] | passed | 0.
|
31
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:5:1:1] | passed | 0.
|
32
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:5:1:2] | passed | 0.
|
33
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:5:2:1] | passed | 0.
|
34
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:5:2:2] | passed | 0.
|
35
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:5:2:3] | passed | 0.
|
36
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:6:1:1] | passed | 0.
|
37
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:6:1:2] | passed | 0.
|
38
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:6:2:1] | passed | 0.
|
39
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:6:2:2] | passed | 0.
|
40
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:6:2:3] | passed | 0.
|
41
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:7:1:1] | passed | 0.
|
42
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:7:1:2] | passed | 0.
|
43
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:7:2:1] | passed | 0.
|
44
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:7:2:2] | passed | 0.
|
45
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:7:2:3] | passed | 0.
|
46
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:8:1:1] | passed | 0.
|
47
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:8:1:2] | passed | 0.
|
48
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:8:2:1] | passed | 0.
|
49
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:8:2:2] | passed | 0.
|
3
|
+
./spec/rspec/be_valid_when/is_not_present_spec.rb[1:1] | passed | 0.00512 seconds |
|
4
|
+
./spec/rspec/be_valid_when/is_not_present_spec.rb[1:2] | passed | 0.00014 seconds |
|
5
|
+
./spec/rspec/be_valid_when/is_not_present_spec.rb[1:3] | passed | 0.00026 seconds |
|
6
|
+
./spec/rspec/be_valid_when/is_spec.rb[1:1] | passed | 0.00012 seconds |
|
7
|
+
./spec/rspec/be_valid_when/is_spec.rb[1:2:1] | passed | 0.00255 seconds |
|
8
|
+
./spec/rspec/be_valid_when/is_spec.rb[1:3:1] | passed | 0.00422 seconds |
|
9
|
+
./spec/rspec/be_valid_when/is_spec.rb[1:3:2] | passed | 0.00088 seconds |
|
10
|
+
./spec/rspec/be_valid_when/is_spec.rb[1:4] | passed | 0.00009 seconds |
|
11
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:1:1:1] | passed | 0.01004 seconds |
|
12
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:1:1:2] | passed | 0.00012 seconds |
|
13
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:1:2:1] | passed | 0.01104 seconds |
|
14
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:1:2:2] | passed | 0.00012 seconds |
|
15
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:1:2:3] | passed | 0.0002 seconds |
|
16
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:2:1:1] | passed | 0.01205 seconds |
|
17
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:2:1:2] | passed | 0.0002 seconds |
|
18
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:2:2:1] | passed | 0.04928 seconds |
|
19
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:2:2:2] | passed | 0.00059 seconds |
|
20
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:2:2:3] | passed | 0.00118 seconds |
|
21
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:3:1:1] | passed | 0.01121 seconds |
|
22
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:3:1:2] | passed | 0.00012 seconds |
|
23
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:3:2:1] | passed | 0.01146 seconds |
|
24
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:3:2:2] | passed | 0.00012 seconds |
|
25
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:3:2:3] | passed | 0.0003 seconds |
|
26
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:4:1:1] | passed | 0.01026 seconds |
|
27
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:4:1:2] | passed | 0.00019 seconds |
|
28
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:4:2:1] | passed | 0.01105 seconds |
|
29
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:4:2:2] | passed | 0.00017 seconds |
|
30
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:4:2:3] | passed | 0.00028 seconds |
|
31
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:5:1:1] | passed | 0.0119 seconds |
|
32
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:5:1:2] | passed | 0.00019 seconds |
|
33
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:5:2:1] | passed | 0.01206 seconds |
|
34
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:5:2:2] | passed | 0.00013 seconds |
|
35
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:5:2:3] | passed | 0.00033 seconds |
|
36
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:6:1:1] | passed | 0.0105 seconds |
|
37
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:6:1:2] | passed | 0.00013 seconds |
|
38
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:6:2:1] | passed | 0.01807 seconds |
|
39
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:6:2:2] | passed | 0.00024 seconds |
|
40
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:6:2:3] | passed | 0.00029 seconds |
|
41
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:7:1:1] | passed | 0.01052 seconds |
|
42
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:7:1:2] | passed | 0.00011 seconds |
|
43
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:7:2:1] | passed | 0.01054 seconds |
|
44
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:7:2:2] | passed | 0.00013 seconds |
|
45
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:7:2:3] | passed | 0.00028 seconds |
|
46
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:8:1:1] | passed | 0.01328 seconds |
|
47
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:8:1:2] | passed | 0.00014 seconds |
|
48
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:8:2:1] | passed | 0.0119 seconds |
|
49
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:8:2:2] | passed | 0.00017 seconds |
|
50
50
|
./spec/rspec/be_valid_when/is_type_spec.rb[1:8:2:3] | passed | 0.0003 seconds |
|
51
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:9:1:1] | passed | 0.
|
52
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:9:1:2] | passed | 0.
|
53
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:9:2:1] | passed | 0.
|
54
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:9:2:2] | passed | 0.
|
55
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:9:2:3] | passed | 0.
|
56
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:10:1:1] | passed | 0.
|
57
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:10:1:2] | passed | 0.
|
58
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:10:2:1] | passed | 0.
|
59
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:10:2:2] | passed | 0.
|
60
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:10:2:3] | passed | 0.
|
61
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:11:1:1] | passed | 0.
|
62
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:11:1:2] | passed | 0.
|
63
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:11:2:1] | passed | 0.
|
64
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:11:2:2] | passed | 0.
|
65
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:11:2:3] | passed | 0.
|
66
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:12:1:1] | passed | 0.
|
67
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:12:1:2] | passed | 0.
|
68
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:12:2:1] | passed | 0.
|
69
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:12:2:2] | passed | 0.
|
70
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:12:2:3] | passed | 0.
|
71
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:13:1:1] | passed | 0.
|
72
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:13:1:2] | passed | 0.
|
73
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:13:2:1] | passed | 0.
|
74
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:13:2:2] | passed | 0.
|
75
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:13:2:3] | passed | 0.
|
76
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:14:1]
|
77
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:14:2]
|
78
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:
|
79
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:
|
80
|
-
./spec/rspec/
|
81
|
-
./spec/rspec/
|
51
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:9:1:1] | passed | 0.01025 seconds |
|
52
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:9:1:2] | passed | 0.00013 seconds |
|
53
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:9:2:1] | passed | 0.01052 seconds |
|
54
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:9:2:2] | passed | 0.00014 seconds |
|
55
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:9:2:3] | passed | 0.00027 seconds |
|
56
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:10:1:1] | passed | 0.01105 seconds |
|
57
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:10:1:2] | passed | 0.00012 seconds |
|
58
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:10:2:1] | passed | 0.01259 seconds |
|
59
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:10:2:2] | passed | 0.00034 seconds |
|
60
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:10:2:3] | passed | 0.00075 seconds |
|
61
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:11:1:1] | passed | 0.01138 seconds |
|
62
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:11:1:2] | passed | 0.00014 seconds |
|
63
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:11:2:1] | passed | 0.01297 seconds |
|
64
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:11:2:2] | passed | 0.00013 seconds |
|
65
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:11:2:3] | passed | 0.00031 seconds |
|
66
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:12:1:1] | passed | 0.01115 seconds |
|
67
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:12:1:2] | passed | 0.00032 seconds |
|
68
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:12:2:1] | passed | 0.01137 seconds |
|
69
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:12:2:2] | passed | 0.00013 seconds |
|
70
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:12:2:3] | passed | 0.00027 seconds |
|
71
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:13:1:1] | passed | 0.01206 seconds |
|
72
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:13:1:2] | passed | 0.00015 seconds |
|
73
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:13:2:1] | passed | 0.01847 seconds |
|
74
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:13:2:2] | passed | 0.00014 seconds |
|
75
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:13:2:3] | passed | 0.00028 seconds |
|
76
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:14:1:1] | passed | 0.01124 seconds |
|
77
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:14:1:2] | passed | 0.00014 seconds |
|
78
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:14:2:1] | passed | 0.01155 seconds |
|
79
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:14:2:2] | passed | 0.00013 seconds |
|
80
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:14:2:3] | passed | 0.00031 seconds |
|
81
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:15:1] | passed | 0.01496 seconds |
|
82
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:15:2] | passed | 0.00014 seconds |
|
83
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:16:1] | passed | 0.01273 seconds |
|
84
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:16:2] | passed | 0.00018 seconds |
|
85
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:1] | passed | 0.00028 seconds |
|
86
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:2] | passed | 0.00008 seconds |
|
82
87
|
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:3] | passed | 0.00009 seconds |
|
83
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:4] | passed | 0.
|
84
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:5] | passed | 0.
|
85
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:6] | passed | 0.
|
86
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:7] | passed | 0.
|
87
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:8] | passed | 0.
|
88
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:9] | passed | 0.
|
88
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:4] | passed | 0.00067 seconds |
|
89
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:5] | passed | 0.0001 seconds |
|
90
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:6] | passed | 0.00008 seconds |
|
91
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:7] | passed | 0.0001 seconds |
|
92
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:8] | passed | 0.00008 seconds |
|
93
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:9] | passed | 0.00009 seconds |
|
89
94
|
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:10] | passed | 0.00008 seconds |
|
90
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:2:1] | passed | 0.
|
91
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:2:2] | passed | 0.
|
92
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:1] | passed | 0.
|
93
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:2] | passed | 0.
|
95
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:2:1] | passed | 0.00009 seconds |
|
96
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:2:2] | passed | 0.00013 seconds |
|
97
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:1] | passed | 0.00011 seconds |
|
98
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:2] | passed | 0.00011 seconds |
|
94
99
|
./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:3] | passed | 0.0001 seconds |
|
95
100
|
./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:4] | passed | 0.00012 seconds |
|
96
101
|
./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:5] | passed | 0.0001 seconds |
|
97
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:3:1] | passed | 0.
|
98
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:3:2:1] | passed | 0.
|
99
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:3:2:2] | passed | 0.
|
100
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:4:1] | passed | 0.
|
101
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:4:2:1] | passed | 0.
|
102
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:3:1] | passed | 0.00009 seconds |
|
103
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:3:2:1] | passed | 0.00081 seconds |
|
104
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:3:2:2] | passed | 0.00085 seconds |
|
105
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:4:1] | passed | 0.00011 seconds |
|
106
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:4:2:1] | passed | 0.00088 seconds |
|
102
107
|
./spec/rspec/be_valid_when_matcher_spec.rb[1:4:2:2] | passed | 0.00082 seconds |
|
103
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:5] | passed | 0.
|
104
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:6:1] | passed | 0.
|
105
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:6:2] | passed | 0.
|
108
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:5] | passed | 0.00011 seconds |
|
109
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:6:1] | passed | 0.00015 seconds |
|
110
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:6:2] | passed | 0.00015 seconds |
|
106
111
|
./spec/rspec/be_valid_when_matcher_spec.rb[1:6:3] | passed | 0.00011 seconds |
|
107
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:6:4] | passed | 0.
|
108
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:7:1:1] | passed | 0.
|
109
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:7:1:2] | passed | 0.
|
112
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:6:4] | passed | 0.00013 seconds |
|
113
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:7:1:1] | passed | 0.00082 seconds |
|
114
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:7:1:2] | passed | 0.00213 seconds |
|
110
115
|
./spec/rspec/be_valid_when_matcher_spec.rb[1:7:2:1] | passed | 0.00078 seconds |
|
111
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:7:2:2] | passed | 0.
|
112
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:8:1] | passed | 0.
|
113
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:8:2:1] | passed | 0.
|
114
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:9:1] | passed | 0.
|
116
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:7:2:2] | passed | 0.00212 seconds |
|
117
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:8:1] | passed | 0.00085 seconds |
|
118
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:8:2:1] | passed | 0.00083 seconds |
|
119
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:9:1] | passed | 0.00012 seconds |
|
@@ -7,7 +7,7 @@ class FakeModelFoo
|
|
7
7
|
include ActiveModel::Validations
|
8
8
|
|
9
9
|
[Numeric, Integer, Fixnum, Bignum, Float, Complex, Rational, BigDecimal,
|
10
|
-
String, Regexp, Array, Hash, Symbol, TrueClass, FalseClass].each do |type|
|
10
|
+
String, Regexp, Array, Hash, Symbol, TrueClass, FalseClass, Range].each do |type|
|
11
11
|
type_name = type.name.downcase
|
12
12
|
field_name = "#{type_name}_field"
|
13
13
|
not_field_name = "not_#{field_name}"
|
@@ -40,6 +40,7 @@ class FakeModelFoo
|
|
40
40
|
validate :symbol_field_cannot_be_short
|
41
41
|
validate :trueclass_field_cannot_be_false
|
42
42
|
validate :falseclass_field_cannot_be_true
|
43
|
+
validate :range_field_cannot_be_empty
|
43
44
|
|
44
45
|
def regexp_field_cannot_be_empty
|
45
46
|
errors.add(:regexp_field, "can't be empty") if regexp_field.inspect.length < 3
|
@@ -64,6 +65,10 @@ class FakeModelFoo
|
|
64
65
|
def falseclass_field_cannot_be_true
|
65
66
|
errors.add(:falseclass_field, "can't be true") if falseclass_field == true
|
66
67
|
end
|
68
|
+
|
69
|
+
def range_field_cannot_be_empty
|
70
|
+
errors.add(:range_field, "can't be negative") if !range_field.nil? && range_field.min < 0
|
71
|
+
end
|
67
72
|
end
|
68
73
|
|
69
74
|
describe 'be_valid_when' do
|
@@ -72,7 +77,7 @@ describe 'be_valid_when' do
|
|
72
77
|
def invalid_values_for(type_name)
|
73
78
|
{ integer: 42, bignum: 42**42, float: 3.14, complex: 42.to_c, rational: 42.to_r,
|
74
79
|
bigdecimal: BigDecimal.new('42'), string: 'value', regexp: /^value$/, array: [1, 2],
|
75
|
-
hash: {}, symbol: :value
|
80
|
+
hash: {}, symbol: :value, range: 2..42
|
76
81
|
}.reject do |key|
|
77
82
|
if type_name.is_a? Symbol
|
78
83
|
key == type_name
|
@@ -176,6 +181,13 @@ describe 'be_valid_when' do
|
|
176
181
|
no_arguments: /^be valid when #symbol_field is a symbol \(:value\)$/,
|
177
182
|
one_argument: /^be valid when #symbol_field is a symbol \(:some_symbol\)$/
|
178
183
|
}
|
184
|
+
},
|
185
|
+
range: {
|
186
|
+
argument: { passing: 1..2, failing: -3..4 },
|
187
|
+
description: {
|
188
|
+
no_arguments: /^be valid when #range_field is a range \(2..42\)$/,
|
189
|
+
one_argument: /^be valid when #range_field is a range \(1..2\)$/
|
190
|
+
}
|
179
191
|
}
|
180
192
|
}.each do |name, props|
|
181
193
|
method_name = "is_#{name}".to_sym
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-be_valid_when_matcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marek Tuchowski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -85,13 +85,13 @@ signing_key:
|
|
85
85
|
specification_version: 4
|
86
86
|
summary: RSpec be_valid_when matcher for ActiveRecord models.
|
87
87
|
test_files:
|
88
|
+
- spec/examples.cache
|
89
|
+
- spec/support/takes_no_arguments.rb
|
90
|
+
- spec/support/returns_proper_results.rb
|
91
|
+
- spec/support/has_correct_description.rb
|
88
92
|
- spec/spec_helper.rb
|
89
|
-
- spec/rspec/
|
93
|
+
- spec/rspec/be_valid_when/is_type_spec.rb
|
90
94
|
- spec/rspec/be_valid_when/is_spec.rb
|
91
95
|
- spec/rspec/be_valid_when/is_not_present_spec.rb
|
92
|
-
- spec/rspec/
|
93
|
-
- spec/support/returns_proper_results.rb
|
94
|
-
- spec/support/has_correct_description.rb
|
95
|
-
- spec/support/takes_no_arguments.rb
|
96
|
-
- spec/examples.cache
|
96
|
+
- spec/rspec/be_valid_when_matcher_spec.rb
|
97
97
|
has_rdoc:
|