rspec-be_valid_when_matcher 1.0.1 → 1.1.0

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
  SHA1:
3
- metadata.gz: 4ecb1390a1f1dd5222d60871c22e883974a42650
4
- data.tar.gz: 8ca1889bf00f7410e351ac352375e660f9b4e3c4
3
+ metadata.gz: 13656a0df980e172da9d2631a45796fa485a2d7d
4
+ data.tar.gz: 482b5359c69d5dd445dc76bf8398e790dbd3d052
5
5
  SHA512:
6
- metadata.gz: 8bb28772fea0c5e1e3169cd4b6abbc927b3d07834e471e953ddae10b845887d57d5f4bdbda697a229794b0bbe6d8151e776efaa11894c3861b9408bd8ad0ed6c
7
- data.tar.gz: 9c862a67333aeb3234ffe1bf8685fb768953afa343759dfb47b6dcf853591cee62a5711a1a29d30877931b4336044e5e8da96753aee81b7c7a2feb314a0e0d3a
6
+ metadata.gz: cfb78ff406e455eac5b817f0f5e534585696b4910fdc483fd9896b099d10133a4727d24ea1655aa9f4b16b1b0908d24623108240a670dab74739db82b6d23256
7
+ data.tar.gz: a3612cc0e19bbf3c89fbcb5ccef24f91f43a8df8f6f85b65d3aff2ad2be230920fe9fedf8ec7c3ba703206fb32002fd4e2430c2d556167649375fb5017412054
data/README.md CHANGED
@@ -8,6 +8,8 @@ https://travis-ci.org/mtuchowski/rspec-be_valid_when_matcher)
8
8
  https://codeclimate.com/github/mtuchowski/rspec-be_valid_when_matcher)
9
9
  [![Test Coverage](https://codeclimate.com/github/mtuchowski/rspec-be_valid_when_matcher/badges/coverage.svg)](
10
10
  https://codeclimate.com/github/mtuchowski/rspec-be_valid_when_matcher/coverage)
11
+ [![Inline docs](http://inch-ci.org/github/mtuchowski/rspec-be_valid_when_matcher.svg?branch=master)](
12
+ http://inch-ci.org/github/mtuchowski/rspec-be_valid_when_matcher)
11
13
 
12
14
  RSpec matcher for testing ActiveRecord models with a fluent and clear language.
13
15
 
@@ -130,6 +132,13 @@ be_valid_when(:field).is_hash # Defaults to { value: 42 }
130
132
  be_valid_when(:field).is_symbol # Defaults to :value
131
133
  ```
132
134
 
135
+ ### Boolean values
136
+
137
+ ```ruby
138
+ be_valid_when(:field).is_true
139
+ be_valid_when(:field).is_false
140
+ ```
141
+
133
142
  ## MIT Licensed
134
143
 
135
144
  See [LICENSE](https://github.com/mtuchowski/rspec-be_valid_when_matcher/blob/master/LICENSE) file
@@ -129,6 +129,16 @@ module RSpec
129
129
  end
130
130
  end
131
131
 
132
+ # @see BeValidWhenMatcher#is_true
133
+ def is_true
134
+ is(true, 'true')
135
+ end
136
+
137
+ # @see BeValidWhenMatcher#is_false
138
+ def is_false
139
+ is(false, 'false')
140
+ end
141
+
132
142
  private
133
143
 
134
144
  attr_writer :message
@@ -325,5 +335,21 @@ module RSpec
325
335
  # @return [self]
326
336
 
327
337
  # @!endgroup
338
+
339
+ # @!group Logical value
340
+
341
+ # @!method is_true()
342
+ # Check validity of field with `TrueClass` value.
343
+ # @example
344
+ # it { is_expected.to be_valid_when(:field).is_true }
345
+ # @return [self]
346
+
347
+ # @!method is_false()
348
+ # Check validity of field with `FalseClass` value.
349
+ # @example
350
+ # it { is_expected.to be_valid_when(:field).is_false }
351
+ # @return [self]
352
+
353
+ # @!endgroup
328
354
  end
329
355
  end
@@ -1,110 +1,114 @@
1
1
  example_id | status | run_time |
2
2
  ------------------------------------------------------ | ------ | --------------- |
3
- ./spec/rspec/be_valid_when/is_not_present_spec.rb[1:1] | passed | 0.01317 seconds |
4
- ./spec/rspec/be_valid_when/is_not_present_spec.rb[1:2] | passed | 0.00033 seconds |
5
- ./spec/rspec/be_valid_when/is_not_present_spec.rb[1:3] | passed | 0.00069 seconds |
6
- ./spec/rspec/be_valid_when/is_spec.rb[1:1] | passed | 0.0001 seconds |
7
- ./spec/rspec/be_valid_when/is_spec.rb[1:2:1] | passed | 0.00277 seconds |
8
- ./spec/rspec/be_valid_when/is_spec.rb[1:3:1] | passed | 0.00267 seconds |
9
- ./spec/rspec/be_valid_when/is_spec.rb[1:3:2] | passed | 0.00087 seconds |
10
- ./spec/rspec/be_valid_when/is_spec.rb[1:4] | passed | 0.00008 seconds |
11
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:1:1:1] | passed | 0.05099 seconds |
12
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:1:1:2] | passed | 0.00076 seconds |
13
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:1:2:1] | passed | 0.01303 seconds |
14
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:1:2:2] | passed | 0.00015 seconds |
15
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:1:2:3] | passed | 0.00115 seconds |
16
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:2:1:1] | passed | 0.0119 seconds |
17
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:2:1:2] | passed | 0.00013 seconds |
18
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:2:2:1] | passed | 0.01126 seconds |
19
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:2:2:2] | passed | 0.00013 seconds |
20
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:2:2:3] | passed | 0.00028 seconds |
21
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:3:1:1] | passed | 0.01122 seconds |
22
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:3:1:2] | passed | 0.00011 seconds |
23
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:3:2:1] | passed | 0.01112 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.00029 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.00013 seconds |
28
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:4:2:1] | passed | 0.01107 seconds |
29
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:4:2:2] | passed | 0.00013 seconds |
30
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:4:2:3] | passed | 0.0003 seconds |
31
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:5:1:1] | passed | 0.01011 seconds |
3
+ ./spec/rspec/be_valid_when/is_not_present_spec.rb[1:1] | passed | 0.06734 seconds |
4
+ ./spec/rspec/be_valid_when/is_not_present_spec.rb[1:2] | passed | 0.0011 seconds |
5
+ ./spec/rspec/be_valid_when/is_not_present_spec.rb[1:3] | passed | 0.00339 seconds |
6
+ ./spec/rspec/be_valid_when/is_spec.rb[1:1] | passed | 0.0002 seconds |
7
+ ./spec/rspec/be_valid_when/is_spec.rb[1:2:1] | passed | 0.00402 seconds |
8
+ ./spec/rspec/be_valid_when/is_spec.rb[1:3:1] | passed | 0.00282 seconds |
9
+ ./spec/rspec/be_valid_when/is_spec.rb[1:3:2] | passed | 0.00144 seconds |
10
+ ./spec/rspec/be_valid_when/is_spec.rb[1:4] | passed | 0.00012 seconds |
11
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:1:1:1] | passed | 0.01073 seconds |
12
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:1:1:2] | passed | 0.00014 seconds |
13
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:1:2:1] | passed | 0.01301 seconds |
14
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:1:2:2] | passed | 0.00014 seconds |
15
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:1:2:3] | passed | 0.00021 seconds |
16
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:2:1:1] | passed | 0.01034 seconds |
17
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:2:1:2] | passed | 0.00018 seconds |
18
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:2:2:1] | passed | 0.01086 seconds |
19
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:2:2:2] | passed | 0.00012 seconds |
20
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:2:2:3] | passed | 0.00025 seconds |
21
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:3:1:1] | passed | 0.01053 seconds |
22
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:3:1:2] | passed | 0.00013 seconds |
23
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:3:2:1] | passed | 0.01085 seconds |
24
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:3:2:2] | passed | 0.00014 seconds |
25
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:3:2:3] | passed | 0.00166 seconds |
26
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:4:1:1] | passed | 0.01278 seconds |
27
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:4:1:2] | passed | 0.00017 seconds |
28
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:4:2:1] | passed | 0.01238 seconds |
29
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:4:2:2] | passed | 0.00014 seconds |
30
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:4:2:3] | passed | 0.00027 seconds |
31
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:5:1:1] | passed | 0.01061 seconds |
32
32
  ./spec/rspec/be_valid_when/is_type_spec.rb[1:5:1:2] | passed | 0.00014 seconds |
33
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:5:2:1] | passed | 0.01106 seconds |
34
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:5:2:2] | passed | 0.00014 seconds |
35
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:5:2:3] | passed | 0.00027 seconds |
36
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:6:1:1] | passed | 0.01034 seconds |
37
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:6:1:2] | passed | 0.00014 seconds |
38
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:6:2:1] | passed | 0.01091 seconds |
39
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:6:2:2] | passed | 0.00012 seconds |
40
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:6:2:3] | passed | 0.00028 seconds |
41
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:7:1:1] | passed | 0.01106 seconds |
42
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:7:1:2] | passed | 0.00013 seconds |
43
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:7:2:1] | passed | 0.01117 seconds |
44
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:7:2:2] | passed | 0.00014 seconds |
45
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:7:2:3] | passed | 0.00025 seconds |
46
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:8:1:1] | passed | 0.01021 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.01087 seconds |
33
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:5:2:1] | passed | 0.01152 seconds |
34
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:5:2:2] | passed | 0.00016 seconds |
35
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:5:2:3] | passed | 0.00028 seconds |
36
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:6:1:1] | passed | 0.03119 seconds |
37
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:6:1:2] | passed | 0.00024 seconds |
38
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:6:2:1] | passed | 0.02242 seconds |
39
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:6:2:2] | passed | 0.00044 seconds |
40
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:6:2:3] | passed | 0.00055 seconds |
41
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:7:1:1] | passed | 0.01312 seconds |
42
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:7:1:2] | passed | 0.00016 seconds |
43
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:7:2:1] | passed | 0.01436 seconds |
44
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:7:2:2] | passed | 0.00019 seconds |
45
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:7:2:3] | passed | 0.00032 seconds |
46
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:8:1:1] | passed | 0.01014 seconds |
47
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:8:1:2] | passed | 0.00018 seconds |
48
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:8:2:1] | passed | 0.01334 seconds |
49
49
  ./spec/rspec/be_valid_when/is_type_spec.rb[1:8:2:2] | passed | 0.00016 seconds |
50
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:8:2:3] | passed | 0.00027 seconds |
51
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:9:1:1] | passed | 0.01123 seconds |
52
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:9:1:2] | passed | 0.00012 seconds |
53
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:9:2:1] | passed | 0.01098 seconds |
54
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:9:2:2] | passed | 0.00013 seconds |
55
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:9:2:3] | passed | 0.00028 seconds |
56
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:10:1:1] | passed | 0.01248 seconds |
57
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:10:1:2] | passed | 0.00013 seconds |
58
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:10:2:1] | passed | 0.01291 seconds |
59
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:10:2:2] | passed | 0.00013 seconds |
60
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:10:2:3] | passed | 0.00028 seconds |
61
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:11:1:1] | passed | 0.01267 seconds |
62
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:11:1:2] | passed | 0.00013 seconds |
63
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:11:2:1] | passed | 0.01134 seconds |
64
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:11:2:2] | passed | 0.00014 seconds |
65
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:11:2:3] | passed | 0.0003 seconds |
66
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:12:1:1] | passed | 0.01235 seconds |
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.01742 seconds |
52
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:9:1:2] | passed | 0.00022 seconds |
53
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:9:2:1] | passed | 0.02064 seconds |
54
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:9:2:2] | passed | 0.00023 seconds |
55
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:9:2:3] | passed | 0.00048 seconds |
56
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:10:1:1] | passed | 0.01379 seconds |
57
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:10:1:2] | passed | 0.00018 seconds |
58
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:10:2:1] | passed | 0.01777 seconds |
59
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:10:2:2] | passed | 0.00016 seconds |
60
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:10:2:3] | passed | 0.00031 seconds |
61
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:11:1:1] | passed | 0.01228 seconds |
62
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:11:1:2] | passed | 0.00019 seconds |
63
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:11:2:1] | passed | 0.01506 seconds |
64
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:11:2:2] | passed | 0.00012 seconds |
65
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:11:2:3] | passed | 0.00035 seconds |
66
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:12:1:1] | passed | 0.01902 seconds |
67
67
  ./spec/rspec/be_valid_when/is_type_spec.rb[1:12:1:2] | passed | 0.00023 seconds |
68
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:12:2:1] | passed | 0.01492 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.00064 seconds |
71
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:13:1:1] | passed | 0.01411 seconds |
72
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:13:1:2] | passed | 0.00017 seconds |
73
- ./spec/rspec/be_valid_when/is_type_spec.rb[1:13:2:1] | passed | 0.0146 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.00031 seconds |
76
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:1:1] | passed | 0.00058 seconds |
77
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:1:2] | passed | 0.0001 seconds |
78
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:1:3] | passed | 0.00011 seconds |
79
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:1:4] | passed | 0.00221 seconds |
68
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:12:2:1] | passed | 0.01763 seconds |
69
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:12:2:2] | passed | 0.00021 seconds |
70
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:12:2:3] | passed | 0.00043 seconds |
71
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:13:1:1] | passed | 0.01543 seconds |
72
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:13:1:2] | passed | 0.00019 seconds |
73
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:13:2:1] | passed | 0.01743 seconds |
74
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:13:2:2] | passed | 0.00018 seconds |
75
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:13:2:3] | passed | 0.00039 seconds |
76
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:14:1] | passed | 0.01322 seconds |
77
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:14:2] | passed | 0.00015 seconds |
78
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:15:1] | passed | 0.01135 seconds |
79
+ ./spec/rspec/be_valid_when/is_type_spec.rb[1:15:2] | passed | 0.00012 seconds |
80
+ ./spec/rspec/be_valid_when_matcher_spec.rb[1:1:1] | passed | 0.0003 seconds |
81
+ ./spec/rspec/be_valid_when_matcher_spec.rb[1:1:2] | passed | 0.00066 seconds |
82
+ ./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.00008 seconds |
80
84
  ./spec/rspec/be_valid_when_matcher_spec.rb[1:1:5] | passed | 0.00008 seconds |
81
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:1:6] | passed | 0.00008 seconds |
82
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:1:7] | passed | 0.00008 seconds |
83
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:1:8] | passed | 0.00008 seconds |
85
+ ./spec/rspec/be_valid_when_matcher_spec.rb[1:1:6] | passed | 0.0001 seconds |
86
+ ./spec/rspec/be_valid_when_matcher_spec.rb[1:1:7] | passed | 0.00009 seconds |
87
+ ./spec/rspec/be_valid_when_matcher_spec.rb[1:1:8] | passed | 0.0001 seconds |
84
88
  ./spec/rspec/be_valid_when_matcher_spec.rb[1:1:9] | passed | 0.00008 seconds |
85
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:1:10] | passed | 0.00007 seconds |
86
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:2:1] | passed | 0.00012 seconds |
87
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:2:2] | passed | 0.00011 seconds |
88
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:1] | passed | 0.00012 seconds |
89
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:2] | passed | 0.00011 seconds |
90
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:3] | passed | 0.00009 seconds |
91
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:4] | passed | 0.00009 seconds |
92
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:5] | passed | 0.00013 seconds |
93
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:3:1] | passed | 0.00009 seconds |
94
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:3:2:1] | passed | 0.00073 seconds |
95
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:3:2:2] | passed | 0.00072 seconds |
96
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:4:1] | passed | 0.00009 seconds |
97
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:4:2:1] | passed | 0.00072 seconds |
98
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:4:2:2] | passed | 0.00078 seconds |
99
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:5] | passed | 0.00115 seconds |
100
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:6:1] | passed | 0.00014 seconds |
89
+ ./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.00011 seconds |
91
+ ./spec/rspec/be_valid_when_matcher_spec.rb[1:2:2] | passed | 0.00012 seconds |
92
+ ./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:1] | passed | 0.0001 seconds |
93
+ ./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:2] | passed | 0.00014 seconds |
94
+ ./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:3] | passed | 0.0001 seconds |
95
+ ./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:4] | passed | 0.00012 seconds |
96
+ ./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.0001 seconds |
98
+ ./spec/rspec/be_valid_when_matcher_spec.rb[1:3:2:1] | passed | 0.00077 seconds |
99
+ ./spec/rspec/be_valid_when_matcher_spec.rb[1:3:2:2] | passed | 0.00078 seconds |
100
+ ./spec/rspec/be_valid_when_matcher_spec.rb[1:4:1] | passed | 0.0001 seconds |
101
+ ./spec/rspec/be_valid_when_matcher_spec.rb[1:4:2:1] | passed | 0.00101 seconds |
102
+ ./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.0001 seconds |
104
+ ./spec/rspec/be_valid_when_matcher_spec.rb[1:6:1] | passed | 0.00013 seconds |
101
105
  ./spec/rspec/be_valid_when_matcher_spec.rb[1:6:2] | passed | 0.00014 seconds |
102
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:6:3] | passed | 0.0001 seconds |
103
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:6:4] | passed | 0.00009 seconds |
104
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:7:1:1] | passed | 0.00072 seconds |
105
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:7:1:2] | passed | 0.00196 seconds |
106
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:7:2:1] | passed | 0.00072 seconds |
107
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:7:2:2] | passed | 0.00187 seconds |
108
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:8:1] | passed | 0.00129 seconds |
109
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:8:2:1] | passed | 0.0008 seconds |
110
- ./spec/rspec/be_valid_when_matcher_spec.rb[1:9:1] | passed | 0.0001 seconds |
106
+ ./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.0001 seconds |
108
+ ./spec/rspec/be_valid_when_matcher_spec.rb[1:7:1:1] | passed | 0.00077 seconds |
109
+ ./spec/rspec/be_valid_when_matcher_spec.rb[1:7:1:2] | passed | 0.00202 seconds |
110
+ ./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.00209 seconds |
112
+ ./spec/rspec/be_valid_when_matcher_spec.rb[1:8:1] | passed | 0.00089 seconds |
113
+ ./spec/rspec/be_valid_when_matcher_spec.rb[1:8:2:1] | passed | 0.0009 seconds |
114
+ ./spec/rspec/be_valid_when_matcher_spec.rb[1:9:1] | passed | 0.00016 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].each do |type|
10
+ String, Regexp, Array, Hash, Symbol, TrueClass, FalseClass].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}"
@@ -38,6 +38,8 @@ class FakeModelFoo
38
38
  validate :array_field_cannot_be_empty
39
39
  validate :hash_field_cannot_be_empty
40
40
  validate :symbol_field_cannot_be_short
41
+ validate :trueclass_field_cannot_be_false
42
+ validate :falseclass_field_cannot_be_true
41
43
 
42
44
  def regexp_field_cannot_be_empty
43
45
  errors.add(:regexp_field, "can't be empty") if regexp_field.inspect.length < 3
@@ -54,6 +56,14 @@ class FakeModelFoo
54
56
  def symbol_field_cannot_be_short
55
57
  errors.add(:symbol_field, "can't be short") if !symbol_field.nil? && symbol_field.length < 2
56
58
  end
59
+
60
+ def trueclass_field_cannot_be_false
61
+ errors.add(:trueclass_field, "can't be false") if trueclass_field == false
62
+ end
63
+
64
+ def falseclass_field_cannot_be_true
65
+ errors.add(:falseclass_field, "can't be true") if falseclass_field == true
66
+ end
57
67
  end
58
68
 
59
69
  describe 'be_valid_when' do
@@ -210,4 +220,28 @@ describe 'be_valid_when' do
210
220
  end
211
221
  end
212
222
  end
223
+
224
+ context '#is_true' do
225
+ let(:passing_matcher) { be_valid_when(:trueclass_field).is_true }
226
+ let(:failing_matcher) { be_valid_when(:not_trueclass_field).is_true }
227
+
228
+ include_examples 'returns proper results'
229
+
230
+ include_examples 'has correct description' do
231
+ let(:matcher) { passing_matcher }
232
+ let(:description) { /^be valid when #trueclass_field is true \(true\)$/ }
233
+ end
234
+ end
235
+
236
+ context '#is_false' do
237
+ let(:passing_matcher) { be_valid_when(:falseclass_field).is_false }
238
+ let(:failing_matcher) { be_valid_when(:not_falseclass_field).is_false }
239
+
240
+ include_examples 'returns proper results'
241
+
242
+ include_examples 'has correct description' do
243
+ let(:matcher) { passing_matcher }
244
+ let(:description) { /^be valid when #falseclass_field is false \(false\)$/ }
245
+ end
246
+ end
213
247
  end
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.0.1
4
+ version: 1.1.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-09-10 00:00:00.000000000 Z
11
+ date: 2015-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec