rspec-be_valid_when_matcher 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/rspec/be_valid_when_matcher.rb +6 -5
- data/spec/examples.cache +106 -106
- data/spec/rspec/be_valid_when/is_spec.rb +2 -2
- data/spec/rspec/be_valid_when/is_type_spec.rb +2 -2
- data/spec/rspec/be_valid_when_matcher_spec.rb +12 -12
- data/spec/support/returns_proper_results.rb +4 -4
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a51cd06a0053593f3c236b4bf3dd0c587de5b22
|
4
|
+
data.tar.gz: 001694ddb849dd300bb620a23d3a08ffa940bcb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d92240032d58d6268143670a36b9b60ff54c74300cb8e36ec4221f5940a99ed42f8d23a1929720c238aeee639ef7fd17cae4e200835decb78b6b11ffd7e3ebe
|
7
|
+
data.tar.gz: ea5ad7670cf4d843eabb546c34c2ee54626d80d3de6a92b1706ad8c945e0e76b5a685680f4ebc25839687343197c04acffe199bad13f1ae4007c3b374d778168
|
data/README.md
CHANGED
@@ -10,6 +10,8 @@ https://codeclimate.com/github/mtuchowski/rspec-be_valid_when_matcher)
|
|
10
10
|
https://codeclimate.com/github/mtuchowski/rspec-be_valid_when_matcher/coverage)
|
11
11
|
[![Inline docs](http://inch-ci.org/github/mtuchowski/rspec-be_valid_when_matcher.svg?branch=master)](
|
12
12
|
http://inch-ci.org/github/mtuchowski/rspec-be_valid_when_matcher)
|
13
|
+
[![Dependency Status](https://gemnasium.com/mtuchowski/rspec-be_valid_when_matcher.svg)](
|
14
|
+
https://gemnasium.com/mtuchowski/rspec-be_valid_when_matcher)
|
13
15
|
|
14
16
|
RSpec matcher for testing ActiveRecord models with a fluent and clear language.
|
15
17
|
|
@@ -15,7 +15,7 @@ module RSpec
|
|
15
15
|
# @raise ArgumentError if field name is not a symbol.
|
16
16
|
def initialize(field)
|
17
17
|
unless field.instance_of? Symbol
|
18
|
-
|
18
|
+
raise ArgumentError, "field name should be symbol (#{field.inspect})"
|
19
19
|
end
|
20
20
|
|
21
21
|
@field = field
|
@@ -93,7 +93,8 @@ module RSpec
|
|
93
93
|
number_of_arguments = args.size
|
94
94
|
|
95
95
|
if number_of_arguments > 2 || number_of_arguments == 0
|
96
|
-
|
96
|
+
raise ArgumentError, "wrong number of arguments (#{number_of_arguments}
|
97
|
+
insted of 1 or 2)"
|
97
98
|
else
|
98
99
|
self.value = args.shift
|
99
100
|
@message = args.first
|
@@ -124,7 +125,7 @@ module RSpec
|
|
124
125
|
symbol: { value: :value, type: Symbol },
|
125
126
|
range: { value: 2..42, type: Range } }.each do |name, properties|
|
126
127
|
define_method "is_#{name}" do |value = properties[:value]|
|
127
|
-
|
128
|
+
raise ArgumentError, "should be #{name}" unless value.is_a? properties[:type]
|
128
129
|
|
129
130
|
is(value, "a #{name}")
|
130
131
|
end
|
@@ -150,11 +151,11 @@ module RSpec
|
|
150
151
|
end
|
151
152
|
|
152
153
|
def assert_value_existence
|
153
|
-
|
154
|
+
raise ArgumentError, 'missing value' unless @value_set
|
154
155
|
end
|
155
156
|
|
156
157
|
def assert_model_existance
|
157
|
-
|
158
|
+
raise ArgumentError, 'missing model' if @model.nil?
|
158
159
|
end
|
159
160
|
|
160
161
|
def setup_model(model)
|
data/spec/examples.cache
CHANGED
@@ -1,119 +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.
|
3
|
+
./spec/rspec/be_valid_when/is_not_present_spec.rb[1:1] | passed | 0.00514 seconds |
|
4
|
+
./spec/rspec/be_valid_when/is_not_present_spec.rb[1:2] | passed | 0.00012 seconds |
|
5
5
|
./spec/rspec/be_valid_when/is_not_present_spec.rb[1:3] | passed | 0.00023 seconds |
|
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.
|
6
|
+
./spec/rspec/be_valid_when/is_spec.rb[1:1] | passed | 0.00026 seconds |
|
7
|
+
./spec/rspec/be_valid_when/is_spec.rb[1:2:1] | passed | 0.00477 seconds |
|
8
|
+
./spec/rspec/be_valid_when/is_spec.rb[1:3:1] | passed | 0.00264 seconds |
|
9
|
+
./spec/rspec/be_valid_when/is_spec.rb[1:3:2] | passed | 0.00081 seconds |
|
10
|
+
./spec/rspec/be_valid_when/is_spec.rb[1:4] | passed | 0.00013 seconds |
|
11
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:1:1:1] | passed | 0.00962 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.01027 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.00018 seconds |
|
16
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:2:1:1] | passed | 0.00964 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.01066 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.00027 seconds |
|
21
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:3:1:1] | passed | 0.00984 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.01024 seconds |
|
24
24
|
./spec/rspec/be_valid_when/is_type_spec.rb[1:3:2:2] | passed | 0.00013 seconds |
|
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.
|
25
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:3:2:3] | passed | 0.00027 seconds |
|
26
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:4:1:1] | passed | 0.00984 seconds |
|
27
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:4:1:2] | passed | 0.00018 seconds |
|
28
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:4:2:1] | passed | 0.01001 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.00028 seconds |
|
31
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:5:1:1] | passed | 0.01427 seconds |
|
32
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:5:1:2] | passed | 0.00016 seconds |
|
33
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:5:2:1] | passed | 0.01257 seconds |
|
34
34
|
./spec/rspec/be_valid_when/is_type_spec.rb[1:5:2:2] | passed | 0.00014 seconds |
|
35
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.
|
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.
|
36
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:6:1:1] | passed | 0.00954 seconds |
|
37
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:6:1:2] | passed | 0.00012 seconds |
|
38
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:6:2:1] | passed | 0.00967 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.00026 seconds |
|
41
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:7:1:1] | passed | 0.04052 seconds |
|
42
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:7:1:2] | passed | 0.00074 seconds |
|
43
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:7:2:1] | passed | 0.0103 seconds |
|
44
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:7:2:2] | passed | 0.00015 seconds |
|
45
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:7:2:3] | passed | 0.00109 seconds |
|
46
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:8:1:1] | passed | 0.00958 seconds |
|
47
47
|
./spec/rspec/be_valid_when/is_type_spec.rb[1:8:1:2] | passed | 0.00016 seconds |
|
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.
|
50
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:8:2:3] | passed | 0.
|
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.
|
48
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:8:2:1] | passed | 0.01034 seconds |
|
49
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:8:2:2] | passed | 0.00014 seconds |
|
50
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:8:2:3] | passed | 0.00026 seconds |
|
51
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:9:1:1] | passed | 0.00929 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.01107 seconds |
|
54
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:9:2:2] | passed | 0.00011 seconds |
|
55
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:9:2:3] | passed | 0.00025 seconds |
|
56
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:10:1:1] | passed | 0.00995 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.01232 seconds |
|
59
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:10:2:2] | passed | 0.00012 seconds |
|
60
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:10:2:3] | passed | 0.00024 seconds |
|
61
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:11:1:1] | passed | 0.01046 seconds |
|
62
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:11:1:2] | passed | 0.00012 seconds |
|
63
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:11:2:1] | passed | 0.01077 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.00027 seconds |
|
66
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:12:1:1] | passed | 0.01053 seconds |
|
67
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:12:1:2] | passed | 0.00012 seconds |
|
68
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:12:2:1] | passed | 0.01112 seconds |
|
69
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:12:2:2] | passed | 0.00013 seconds |
|
70
70
|
./spec/rspec/be_valid_when/is_type_spec.rb[1:12:2:3] | passed | 0.00026 seconds |
|
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:1] | passed | 0.
|
77
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:14:1:2] | passed | 0.
|
78
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:14:2:1] | passed | 0.
|
79
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:14:2:2] | passed | 0.
|
80
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:14:2:3] | passed | 0.
|
81
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:15:1] | passed | 0.
|
82
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:15:2] | passed | 0.
|
83
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:16:1] | passed | 0.
|
84
|
-
./spec/rspec/be_valid_when/is_type_spec.rb[1:16:2] | passed | 0.
|
85
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:1] | passed | 0.
|
86
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:2] | passed | 0.
|
71
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:13:1:1] | passed | 0.01115 seconds |
|
72
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:13:1:2] | passed | 0.00013 seconds |
|
73
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:13:2:1] | passed | 0.01074 seconds |
|
74
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:13:2:2] | passed | 0.00012 seconds |
|
75
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:13:2:3] | passed | 0.00027 seconds |
|
76
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:14:1:1] | passed | 0.01062 seconds |
|
77
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:14:1:2] | passed | 0.00012 seconds |
|
78
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:14:2:1] | passed | 0.01095 seconds |
|
79
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:14:2:2] | passed | 0.00012 seconds |
|
80
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:14:2:3] | passed | 0.00026 seconds |
|
81
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:15:1] | passed | 0.01055 seconds |
|
82
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:15:2] | passed | 0.00012 seconds |
|
83
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:16:1] | passed | 0.01128 seconds |
|
84
|
+
./spec/rspec/be_valid_when/is_type_spec.rb[1:16:2] | passed | 0.00011 seconds |
|
85
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:1] | passed | 0.00035 seconds |
|
86
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:2] | passed | 0.0002 seconds |
|
87
87
|
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:3] | passed | 0.00009 seconds |
|
88
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:4] | passed | 0.
|
89
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:5] | passed | 0.
|
88
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:4] | passed | 0.00008 seconds |
|
89
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:5] | passed | 0.00053 seconds |
|
90
90
|
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:6] | passed | 0.00008 seconds |
|
91
91
|
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:7] | passed | 0.00008 seconds |
|
92
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:8] | passed | 0.
|
93
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:9] | passed | 0.
|
94
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:10] | passed | 0.
|
95
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:2:1] | passed | 0.
|
96
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:2:2] | passed | 0.
|
97
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:1] | passed | 0.
|
98
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:2] | passed | 0.
|
99
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:3] | passed | 0.
|
100
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:4] | passed | 0.
|
101
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:5] | passed | 0.
|
102
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:3:1] | passed | 0.
|
103
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:3:2:1] | passed | 0.
|
104
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:3:2:2] | passed | 0.
|
92
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:8] | passed | 0.0001 seconds |
|
93
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:9] | passed | 0.0002 seconds |
|
94
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:1:10] | passed | 0.00008 seconds |
|
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.00011 seconds |
|
97
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:1] | passed | 0.0001 seconds |
|
98
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:2] | passed | 0.00009 seconds |
|
99
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:3] | passed | 0.00009 seconds |
|
100
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:4] | passed | 0.0001 seconds |
|
101
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:2:3:5] | passed | 0.00009 seconds |
|
102
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:3:1] | passed | 0.00008 seconds |
|
103
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:3:2:1] | passed | 0.00065 seconds |
|
104
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:3:2:2] | passed | 0.00066 seconds |
|
105
105
|
./spec/rspec/be_valid_when_matcher_spec.rb[1:4:1] | passed | 0.00008 seconds |
|
106
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:4:2:1] | passed | 0.
|
107
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:4:2:2] | passed | 0.
|
108
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:5] | passed | 0.
|
109
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:6:1] | passed | 0.
|
110
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:6:2] | passed | 0.
|
111
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:6:3] | passed | 0.
|
106
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:4:2:1] | passed | 0.00065 seconds |
|
107
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:4:2:2] | passed | 0.00066 seconds |
|
108
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:5] | passed | 0.00009 seconds |
|
109
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:6:1] | passed | 0.00012 seconds |
|
110
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:6:2] | passed | 0.00013 seconds |
|
111
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:6:3] | passed | 0.0001 seconds |
|
112
112
|
./spec/rspec/be_valid_when_matcher_spec.rb[1:6:4] | passed | 0.00009 seconds |
|
113
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:7:1:1] | passed | 0.
|
114
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:7:1:2] | passed | 0.
|
115
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:7:2:1] | passed | 0.
|
116
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:7:2:2] | passed | 0.
|
117
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:8:1] | passed | 0.
|
118
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:8:2:1] | passed | 0.
|
119
|
-
./spec/rspec/be_valid_when_matcher_spec.rb[1:9:1] | passed | 0.
|
113
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:7:1:1] | passed | 0.00069 seconds |
|
114
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:7:1:2] | passed | 0.00172 seconds |
|
115
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:7:2:1] | passed | 0.00064 seconds |
|
116
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:7:2:2] | passed | 0.00176 seconds |
|
117
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:8:1] | passed | 0.00078 seconds |
|
118
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:8:2:1] | passed | 0.00074 seconds |
|
119
|
+
./spec/rspec/be_valid_when_matcher_spec.rb[1:9:1] | passed | 0.00011 seconds |
|
@@ -14,8 +14,8 @@ RSpec.shared_examples 'sets the field value' do
|
|
14
14
|
expect { subject.matches? model }.not_to raise_error
|
15
15
|
expect { subject.does_not_match? model }.not_to raise_error
|
16
16
|
|
17
|
-
expect(subject.matches?
|
18
|
-
expect(subject.does_not_match?
|
17
|
+
expect(subject.matches?(model)).to eq true
|
18
|
+
expect(subject.does_not_match?(model)).to eq false
|
19
19
|
|
20
20
|
expect { subject.description }.not_to raise_error
|
21
21
|
end
|
@@ -47,11 +47,11 @@ class FakeModelFoo
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def array_field_cannot_be_empty
|
50
|
-
errors.add(:array_field, "can't be empty") if !array_field.nil? && array_field.
|
50
|
+
errors.add(:array_field, "can't be empty") if !array_field.nil? && array_field.empty?
|
51
51
|
end
|
52
52
|
|
53
53
|
def hash_field_cannot_be_empty
|
54
|
-
errors.add(:hash_field, "can't be empty") if !hash_field.nil? && hash_field.keys.
|
54
|
+
errors.add(:hash_field, "can't be empty") if !hash_field.nil? && hash_field.keys.empty?
|
55
55
|
end
|
56
56
|
|
57
57
|
def symbol_field_cannot_be_short
|
@@ -58,11 +58,11 @@ describe 'be_valid_when' do
|
|
58
58
|
subject { be_valid_when :field }
|
59
59
|
|
60
60
|
it 'should fail on #matches?' do
|
61
|
-
expect { subject.matches?
|
61
|
+
expect { subject.matches?(model) }.to raise_error ArgumentError
|
62
62
|
end
|
63
63
|
|
64
64
|
it 'should fail on #does_not_match?' do
|
65
|
-
expect { subject.does_not_match?
|
65
|
+
expect { subject.does_not_match?(model) }.to raise_error ArgumentError
|
66
66
|
end
|
67
67
|
|
68
68
|
it 'should fail on #failure_message' do
|
@@ -88,11 +88,11 @@ describe 'be_valid_when' do
|
|
88
88
|
subject { be_valid_when :field, 'value' }
|
89
89
|
|
90
90
|
it 'should not fail on #matches?' do
|
91
|
-
expect { subject.matches?
|
91
|
+
expect { subject.matches?(model) }.not_to raise_error
|
92
92
|
end
|
93
93
|
|
94
94
|
it 'should not fail on #does_not_match?' do
|
95
|
-
expect { subject.does_not_match?
|
95
|
+
expect { subject.does_not_match?(model) }.not_to raise_error
|
96
96
|
end
|
97
97
|
end
|
98
98
|
end
|
@@ -106,11 +106,11 @@ describe 'be_valid_when' do
|
|
106
106
|
subject { be_valid_when :field, 'value', 'some text' }
|
107
107
|
|
108
108
|
it 'should not fail on #matches?' do
|
109
|
-
expect { subject.matches?
|
109
|
+
expect { subject.matches?(model) }.not_to raise_error
|
110
110
|
end
|
111
111
|
|
112
112
|
it 'should not fail on #does_not_match?' do
|
113
|
-
expect { subject.does_not_match?
|
113
|
+
expect { subject.does_not_match?(model) }.not_to raise_error
|
114
114
|
end
|
115
115
|
end
|
116
116
|
end
|
@@ -147,26 +147,26 @@ describe 'be_valid_when' do
|
|
147
147
|
context 'using #matches?' do
|
148
148
|
it 'is setting the proper field using the provided value' do
|
149
149
|
model.field = nil
|
150
|
-
subject.is('value').matches?
|
150
|
+
subject.is('value').matches?(model)
|
151
151
|
expect(model.field).to eq 'value'
|
152
152
|
end
|
153
153
|
|
154
154
|
it 'returns proper result' do
|
155
|
-
expect(subject.is('value').matches?
|
156
|
-
expect(subject.is(nil).matches?
|
155
|
+
expect(subject.is('value').matches?(model)).to eq true
|
156
|
+
expect(subject.is(nil).matches?(model)).to eq false
|
157
157
|
end
|
158
158
|
end
|
159
159
|
|
160
160
|
context 'using #does_not_match?' do
|
161
161
|
it 'is setting the proper field using the provided value' do
|
162
162
|
model.field = nil
|
163
|
-
subject.is('value').does_not_match?
|
163
|
+
subject.is('value').does_not_match?(model)
|
164
164
|
expect(model.field).to eq 'value'
|
165
165
|
end
|
166
166
|
|
167
167
|
it 'returns proper result' do
|
168
|
-
expect(subject.is('value').does_not_match?
|
169
|
-
expect(subject.is(nil).does_not_match?
|
168
|
+
expect(subject.is('value').does_not_match?(model)).to eq false
|
169
|
+
expect(subject.is(nil).does_not_match?(model)).to eq true
|
170
170
|
end
|
171
171
|
end
|
172
172
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
RSpec.shared_examples 'returns proper results' do
|
2
2
|
it 'returns proper result' do
|
3
|
-
expect(passing_matcher.matches?
|
4
|
-
expect(passing_matcher.does_not_match?
|
5
|
-
expect(failing_matcher.matches?
|
6
|
-
expect(failing_matcher.does_not_match?
|
3
|
+
expect(passing_matcher.matches?(model)).to eq true
|
4
|
+
expect(passing_matcher.does_not_match?(model)).to eq false
|
5
|
+
expect(failing_matcher.matches?(model)).to eq false
|
6
|
+
expect(failing_matcher.does_not_match?(model)).to eq true
|
7
7
|
end
|
8
8
|
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.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marek Tuchowski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -80,18 +80,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
82
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
83
|
+
rubygems_version: 2.5.1
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: RSpec be_valid_when matcher for ActiveRecord models.
|
87
87
|
test_files:
|
88
|
+
- spec/rspec/be_valid_when/is_not_present_spec.rb
|
89
|
+
- spec/rspec/be_valid_when/is_spec.rb
|
90
|
+
- spec/rspec/be_valid_when/is_type_spec.rb
|
91
|
+
- spec/rspec/be_valid_when_matcher_spec.rb
|
92
|
+
- spec/spec_helper.rb
|
88
93
|
- spec/examples.cache
|
89
|
-
- spec/support/takes_no_arguments.rb
|
90
94
|
- spec/support/returns_proper_results.rb
|
91
95
|
- spec/support/has_correct_description.rb
|
92
|
-
- spec/
|
93
|
-
- spec/rspec/be_valid_when/is_type_spec.rb
|
94
|
-
- spec/rspec/be_valid_when/is_spec.rb
|
95
|
-
- spec/rspec/be_valid_when/is_not_present_spec.rb
|
96
|
-
- spec/rspec/be_valid_when_matcher_spec.rb
|
96
|
+
- spec/support/takes_no_arguments.rb
|
97
97
|
has_rdoc:
|