defra_ruby_validators 2.5.0 → 2.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +10 -0
- data/config/locales/defra_ruby/validators/mobile_phone_number_validator/en.yml +7 -0
- data/lib/defra_ruby/validators/companies_house_number_validator.rb +3 -3
- data/lib/defra_ruby/validators/mobile_phone_number_validator.rb +32 -0
- data/lib/defra_ruby/validators/version.rb +1 -1
- data/lib/defra_ruby/validators.rb +1 -0
- metadata +24 -175
- data/spec/defra_ruby/validators/business_type_validator_spec.rb +0 -56
- data/spec/defra_ruby/validators/companies_house_number_validator_spec.rb +0 -124
- data/spec/defra_ruby/validators/companies_house_service_spec.rb +0 -98
- data/spec/defra_ruby/validators/configuration_spec.rb +0 -49
- data/spec/defra_ruby/validators/email_validator_spec.rb +0 -46
- data/spec/defra_ruby/validators/grid_reference_validator_spec.rb +0 -57
- data/spec/defra_ruby/validators/location_validator_spec.rb +0 -56
- data/spec/defra_ruby/validators/past_date_validator_spec.rb +0 -35
- data/spec/defra_ruby/validators/phone_number_validator_spec.rb +0 -59
- data/spec/defra_ruby/validators/position_validator_spec.rb +0 -47
- data/spec/defra_ruby/validators/token_validator_spec.rb +0 -45
- data/spec/defra_ruby/validators/true_false_validator_spec.rb +0 -37
- data/spec/defra_ruby/validators_spec.rb +0 -12
- data/spec/examples.txt +0 -189
- data/spec/spec_helper.rb +0 -87
- data/spec/support/defra_ruby_validators.rb +0 -16
- data/spec/support/helpers/text_generator.rb +0 -17
- data/spec/support/helpers/translator.rb +0 -15
- data/spec/support/i18n.rb +0 -8
- data/spec/support/pry.rb +0 -7
- data/spec/support/shared_examples/validators/characters_validator.rb +0 -29
- data/spec/support/shared_examples/validators/invalid_record.rb +0 -29
- data/spec/support/shared_examples/validators/length_validator.rb +0 -29
- data/spec/support/shared_examples/validators/presence_validator.rb +0 -29
- data/spec/support/shared_examples/validators/selection_validator.rb +0 -40
- data/spec/support/shared_examples/validators/valid_record.rb +0 -12
- data/spec/support/shared_examples/validators/validator.rb +0 -8
- data/spec/support/simplecov.rb +0 -17
data/spec/examples.txt
DELETED
@@ -1,189 +0,0 @@
|
|
1
|
-
example_id | status | run_time |
|
2
|
-
------------------------------------------------------------------------------------ | ------ | --------------- |
|
3
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:1:1] | passed | 0.00011 seconds |
|
4
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:1] | passed | 0.00014 seconds |
|
5
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:1:1:1] | passed | 0.00024 seconds |
|
6
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:1:1:2] | passed | 0.00013 seconds |
|
7
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:2:1:1:1] | passed | 0.00021 seconds |
|
8
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:2:1:1:2] | passed | 0.00087 seconds |
|
9
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:2:1:1:3] | passed | 0.0005 seconds |
|
10
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:2:1:1:4:1] | passed | 0.00122 seconds |
|
11
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:2:2:1:1] | passed | 0.00019 seconds |
|
12
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:2:2:1:2] | passed | 0.00051 seconds |
|
13
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:2:2:1:3] | passed | 0.00052 seconds |
|
14
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:2:2:1:4:1] | passed | 0.00106 seconds |
|
15
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:3:1:1:1] | passed | 0.00063 seconds |
|
16
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:3:1:1:2] | passed | 0.00058 seconds |
|
17
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:3:2:1:1] | passed | 0.0007 seconds |
|
18
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:3:2:1:2] | passed | 0.00096 seconds |
|
19
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:3:2:1:3] | passed | 0.00099 seconds |
|
20
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:3:2:1:4:1] | passed | 0.00122 seconds |
|
21
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:1:1] | passed | 0.00021 seconds |
|
22
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:1:1:1:1] | passed | 0.00067 seconds |
|
23
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:1:1:1:2] | passed | 0.00049 seconds |
|
24
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:1:2:1:1] | passed | 0.00049 seconds |
|
25
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:1:2:1:2] | passed | 0.00064 seconds |
|
26
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:1:3:1:1] | passed | 0.00087 seconds |
|
27
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:1:3:1:2] | passed | 0.00128 seconds |
|
28
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:1:4:1:1] | passed | 0.00052 seconds |
|
29
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:1:4:1:2] | passed | 0.00057 seconds |
|
30
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:1:1:1] | passed | 0.00024 seconds |
|
31
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:1:1:2] | passed | 0.0008 seconds |
|
32
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:1:1:3] | passed | 0.0007 seconds |
|
33
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:1:1:4:1] | passed | 0.00137 seconds |
|
34
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:2:1:1] | passed | 0.00018 seconds |
|
35
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:2:1:2] | passed | 0.00059 seconds |
|
36
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:2:1:3] | passed | 0.00055 seconds |
|
37
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:2:1:4:1] | passed | 0.00098 seconds |
|
38
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:3:1:1] | passed | 0.00058 seconds |
|
39
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:3:1:2] | passed | 0.00105 seconds |
|
40
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:3:1:3] | passed | 0.00084 seconds |
|
41
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:3:1:4:1] | passed | 0.00137 seconds |
|
42
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:4:1:1] | passed | 0.00051 seconds |
|
43
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:4:1:2] | passed | 0.00084 seconds |
|
44
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:4:1:3] | passed | 0.00085 seconds |
|
45
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:4:1:4:1] | passed | 0.0013 seconds |
|
46
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:5:1] | passed | 0.00061 seconds |
|
47
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:3:1:1] | passed | 0.00054 seconds |
|
48
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:3:1:2] | passed | 0.00135 seconds |
|
49
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:3:1:3] | passed | 0.00083 seconds |
|
50
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:3:1:4:1] | passed | 0.00139 seconds |
|
51
|
-
./spec/defra_ruby/validators/companies_house_service_spec.rb[1:1:1:1] | passed | 0.0211 seconds |
|
52
|
-
./spec/defra_ruby/validators/companies_house_service_spec.rb[1:1:2:1] | passed | 0.01246 seconds |
|
53
|
-
./spec/defra_ruby/validators/companies_house_service_spec.rb[1:1:3:1] | passed | 0.01366 seconds |
|
54
|
-
./spec/defra_ruby/validators/companies_house_service_spec.rb[1:1:4:1:1] | passed | 0.01198 seconds |
|
55
|
-
./spec/defra_ruby/validators/companies_house_service_spec.rb[1:1:4:1:2:1] | passed | 0.01318 seconds |
|
56
|
-
./spec/defra_ruby/validators/companies_house_service_spec.rb[1:1:5:1:1] | passed | 0.01765 seconds |
|
57
|
-
./spec/defra_ruby/validators/companies_house_service_spec.rb[1:1:5:2:1] | passed | 0.01388 seconds |
|
58
|
-
./spec/defra_ruby/validators/configuration_spec.rb[1:1:1] | passed | 0.00396 seconds |
|
59
|
-
./spec/defra_ruby/validators/configuration_spec.rb[1:2] | passed | 0.0001 seconds |
|
60
|
-
./spec/defra_ruby/validators/configuration_spec.rb[1:3:1:1] | passed | 0.00015 seconds |
|
61
|
-
./spec/defra_ruby/validators/configuration_spec.rb[1:3:2:1] | passed | 0.00016 seconds |
|
62
|
-
./spec/defra_ruby/validators/email_validator_spec.rb[1:1:1] | passed | 0.0031 seconds |
|
63
|
-
./spec/defra_ruby/validators/email_validator_spec.rb[1:2:1] | passed | 0.00012 seconds |
|
64
|
-
./spec/defra_ruby/validators/email_validator_spec.rb[1:2:2:1:1:1] | passed | 0.00017 seconds |
|
65
|
-
./spec/defra_ruby/validators/email_validator_spec.rb[1:2:2:1:1:2] | passed | 0.00024 seconds |
|
66
|
-
./spec/defra_ruby/validators/email_validator_spec.rb[1:2:2:2:1:1:1] | passed | 0.00024 seconds |
|
67
|
-
./spec/defra_ruby/validators/email_validator_spec.rb[1:2:2:2:1:1:2] | passed | 0.00047 seconds |
|
68
|
-
./spec/defra_ruby/validators/email_validator_spec.rb[1:2:2:2:1:1:3] | passed | 0.00052 seconds |
|
69
|
-
./spec/defra_ruby/validators/email_validator_spec.rb[1:2:2:2:1:1:4:1] | passed | 0.00123 seconds |
|
70
|
-
./spec/defra_ruby/validators/email_validator_spec.rb[1:3:1:1:1:1] | passed | 0.01345 seconds |
|
71
|
-
./spec/defra_ruby/validators/email_validator_spec.rb[1:3:1:1:1:2] | passed | 0.00176 seconds |
|
72
|
-
./spec/defra_ruby/validators/email_validator_spec.rb[1:3:1:1:1:3] | passed | 0.00061 seconds |
|
73
|
-
./spec/defra_ruby/validators/email_validator_spec.rb[1:3:1:1:1:4:1] | passed | 0.01457 seconds |
|
74
|
-
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:1:1] | passed | 0.00011 seconds |
|
75
|
-
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:2:1] | passed | 0.00021 seconds |
|
76
|
-
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:2:2:1:1:1] | passed | 0.00032 seconds |
|
77
|
-
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:2:2:1:1:2] | passed | 0.00027 seconds |
|
78
|
-
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:2:2:2:1:1:1] | passed | 0.00046 seconds |
|
79
|
-
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:2:2:2:1:1:2] | passed | 0.0011 seconds |
|
80
|
-
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:2:2:2:1:1:3] | passed | 0.00069 seconds |
|
81
|
-
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:2:2:2:1:1:4:1] | passed | 0.00132 seconds |
|
82
|
-
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:3:1:1:1:1] | passed | 0.00025 seconds |
|
83
|
-
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:3:1:1:1:2] | passed | 0.00064 seconds |
|
84
|
-
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:3:1:1:1:3] | passed | 0.00057 seconds |
|
85
|
-
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:3:1:1:1:4:1] | passed | 0.0013 seconds |
|
86
|
-
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:3:1:2:1:1] | passed | 0.00035 seconds |
|
87
|
-
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:3:1:2:1:2] | passed | 0.00069 seconds |
|
88
|
-
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:3:1:2:1:3] | passed | 0.00118 seconds |
|
89
|
-
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:3:1:2:1:4:1] | passed | 0.00139 seconds |
|
90
|
-
./spec/defra_ruby/validators/location_validator_spec.rb[1:1:1] | passed | 0.00023 seconds |
|
91
|
-
./spec/defra_ruby/validators/location_validator_spec.rb[1:2:1] | passed | 0.00014 seconds |
|
92
|
-
./spec/defra_ruby/validators/location_validator_spec.rb[1:2:2:1:1:1] | passed | 0.00016 seconds |
|
93
|
-
./spec/defra_ruby/validators/location_validator_spec.rb[1:2:2:1:1:2] | passed | 0.00019 seconds |
|
94
|
-
./spec/defra_ruby/validators/location_validator_spec.rb[1:2:2:2:1:1:1] | passed | 0.00023 seconds |
|
95
|
-
./spec/defra_ruby/validators/location_validator_spec.rb[1:2:2:2:1:1:2] | passed | 0.0005 seconds |
|
96
|
-
./spec/defra_ruby/validators/location_validator_spec.rb[1:2:2:2:1:1:3] | passed | 0.00055 seconds |
|
97
|
-
./spec/defra_ruby/validators/location_validator_spec.rb[1:2:2:2:1:1:4:1] | passed | 0.00118 seconds |
|
98
|
-
./spec/defra_ruby/validators/location_validator_spec.rb[1:2:2:2:2:1:1] | passed | 0.00032 seconds |
|
99
|
-
./spec/defra_ruby/validators/location_validator_spec.rb[1:2:2:2:2:1:2] | passed | 0.00051 seconds |
|
100
|
-
./spec/defra_ruby/validators/location_validator_spec.rb[1:2:2:2:2:1:3] | passed | 0.00053 seconds |
|
101
|
-
./spec/defra_ruby/validators/location_validator_spec.rb[1:2:2:2:2:1:4:1] | passed | 0.00386 seconds |
|
102
|
-
./spec/defra_ruby/validators/location_validator_spec.rb[1:3:1:1:1] | passed | 0.00117 seconds |
|
103
|
-
./spec/defra_ruby/validators/location_validator_spec.rb[1:3:1:1:2] | passed | 0.00076 seconds |
|
104
|
-
./spec/defra_ruby/validators/location_validator_spec.rb[1:3:2:1:1] | passed | 0.0008 seconds |
|
105
|
-
./spec/defra_ruby/validators/location_validator_spec.rb[1:3:2:1:2] | passed | 0.0014 seconds |
|
106
|
-
./spec/defra_ruby/validators/location_validator_spec.rb[1:3:2:1:3] | passed | 0.00096 seconds |
|
107
|
-
./spec/defra_ruby/validators/location_validator_spec.rb[1:3:2:1:4:1] | passed | 0.00132 seconds |
|
108
|
-
./spec/defra_ruby/validators/past_date_validator_spec.rb[1:1:1] | passed | 0.00014 seconds |
|
109
|
-
./spec/defra_ruby/validators/past_date_validator_spec.rb[1:1:2] | passed | 0.00012 seconds |
|
110
|
-
./spec/defra_ruby/validators/past_date_validator_spec.rb[1:2:1] | passed | 0.00016 seconds |
|
111
|
-
./spec/defra_ruby/validators/past_date_validator_spec.rb[1:2:2] | passed | 0.00052 seconds |
|
112
|
-
./spec/defra_ruby/validators/past_date_validator_spec.rb[1:2:3] | passed | 0.0005 seconds |
|
113
|
-
./spec/defra_ruby/validators/past_date_validator_spec.rb[1:2:4:1] | passed | 0.00098 seconds |
|
114
|
-
./spec/defra_ruby/validators/past_date_validator_spec.rb[1:3:1] | passed | 0.00033 seconds |
|
115
|
-
./spec/defra_ruby/validators/past_date_validator_spec.rb[1:3:2] | passed | 0.00051 seconds |
|
116
|
-
./spec/defra_ruby/validators/past_date_validator_spec.rb[1:3:3] | passed | 0.00116 seconds |
|
117
|
-
./spec/defra_ruby/validators/past_date_validator_spec.rb[1:3:4:1] | passed | 0.00112 seconds |
|
118
|
-
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:1:1] | passed | 0.00018 seconds |
|
119
|
-
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:2:1] | passed | 0.00022 seconds |
|
120
|
-
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:2:2:1:1:1] | passed | 0.00428 seconds |
|
121
|
-
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:2:2:1:1:2] | passed | 0.02456 seconds |
|
122
|
-
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:2:2:2:1:1:1] | passed | 0.00023 seconds |
|
123
|
-
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:2:2:2:1:1:2] | passed | 0.0006 seconds |
|
124
|
-
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:2:2:2:1:1:3] | passed | 0.00367 seconds |
|
125
|
-
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:2:2:2:1:1:4:1] | passed | 0.00122 seconds |
|
126
|
-
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:3:1] | passed | 0.00011 seconds |
|
127
|
-
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:3:2:1:1:1] | passed | 0.00187 seconds |
|
128
|
-
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:3:2:1:1:2] | passed | 0.00177 seconds |
|
129
|
-
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:3:2:2:1:1:1] | passed | 0.00021 seconds |
|
130
|
-
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:3:2:2:1:1:2] | passed | 0.00048 seconds |
|
131
|
-
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:3:2:2:1:1:3] | passed | 0.00056 seconds |
|
132
|
-
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:3:2:2:1:1:4:1] | passed | 0.00103 seconds |
|
133
|
-
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:4:1:1:1:1] | passed | 0.00052 seconds |
|
134
|
-
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:4:1:1:1:2] | passed | 0.00088 seconds |
|
135
|
-
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:4:1:1:1:3] | passed | 0.01128 seconds |
|
136
|
-
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:4:1:1:1:4:1] | passed | 0.00177 seconds |
|
137
|
-
./spec/defra_ruby/validators/position_validator_spec.rb[1:1:1] | passed | 0.00011 seconds |
|
138
|
-
./spec/defra_ruby/validators/position_validator_spec.rb[1:2:1] | passed | 0.00014 seconds |
|
139
|
-
./spec/defra_ruby/validators/position_validator_spec.rb[1:2:2:1:1:1] | passed | 0.00018 seconds |
|
140
|
-
./spec/defra_ruby/validators/position_validator_spec.rb[1:2:2:1:1:2] | passed | 0.00016 seconds |
|
141
|
-
./spec/defra_ruby/validators/position_validator_spec.rb[1:2:2:2:1:1:1] | passed | 0.00022 seconds |
|
142
|
-
./spec/defra_ruby/validators/position_validator_spec.rb[1:2:2:2:1:1:2] | passed | 0.00093 seconds |
|
143
|
-
./spec/defra_ruby/validators/position_validator_spec.rb[1:2:2:2:1:1:3] | passed | 0.00057 seconds |
|
144
|
-
./spec/defra_ruby/validators/position_validator_spec.rb[1:2:2:2:1:1:4:1] | passed | 0.00133 seconds |
|
145
|
-
./spec/defra_ruby/validators/position_validator_spec.rb[1:3:1] | passed | 0.00011 seconds |
|
146
|
-
./spec/defra_ruby/validators/position_validator_spec.rb[1:3:2:1:1:1] | passed | 0.00016 seconds |
|
147
|
-
./spec/defra_ruby/validators/position_validator_spec.rb[1:3:2:1:1:2] | passed | 0.00015 seconds |
|
148
|
-
./spec/defra_ruby/validators/position_validator_spec.rb[1:3:2:2:1:1:1] | passed | 0.00021 seconds |
|
149
|
-
./spec/defra_ruby/validators/position_validator_spec.rb[1:3:2:2:1:1:2] | passed | 0.00053 seconds |
|
150
|
-
./spec/defra_ruby/validators/position_validator_spec.rb[1:3:2:2:1:1:3] | passed | 0.00072 seconds |
|
151
|
-
./spec/defra_ruby/validators/position_validator_spec.rb[1:3:2:2:1:1:4:1] | passed | 0.00166 seconds |
|
152
|
-
./spec/defra_ruby/validators/position_validator_spec.rb[1:4:1:1:1:1] | passed | 0.00014 seconds |
|
153
|
-
./spec/defra_ruby/validators/position_validator_spec.rb[1:4:1:1:1:2] | passed | 0.00016 seconds |
|
154
|
-
./spec/defra_ruby/validators/token_validator_spec.rb[1:1:1] | passed | 0.00015 seconds |
|
155
|
-
./spec/defra_ruby/validators/token_validator_spec.rb[1:2:1] | passed | 0.00018 seconds |
|
156
|
-
./spec/defra_ruby/validators/token_validator_spec.rb[1:2:2:1:1:1] | passed | 0.00019 seconds |
|
157
|
-
./spec/defra_ruby/validators/token_validator_spec.rb[1:2:2:1:1:2] | passed | 0.00013 seconds |
|
158
|
-
./spec/defra_ruby/validators/token_validator_spec.rb[1:2:2:2:1:1:1] | passed | 0.00034 seconds |
|
159
|
-
./spec/defra_ruby/validators/token_validator_spec.rb[1:2:2:2:1:1:2] | passed | 0.00045 seconds |
|
160
|
-
./spec/defra_ruby/validators/token_validator_spec.rb[1:2:2:2:1:1:3] | passed | 0.0009 seconds |
|
161
|
-
./spec/defra_ruby/validators/token_validator_spec.rb[1:2:2:2:1:1:4:1] | passed | 0.00141 seconds |
|
162
|
-
./spec/defra_ruby/validators/token_validator_spec.rb[1:3:1:1:1:1] | passed | 0.00032 seconds |
|
163
|
-
./spec/defra_ruby/validators/token_validator_spec.rb[1:3:1:1:1:2] | passed | 0.00058 seconds |
|
164
|
-
./spec/defra_ruby/validators/token_validator_spec.rb[1:3:1:1:1:3] | passed | 0.0009 seconds |
|
165
|
-
./spec/defra_ruby/validators/token_validator_spec.rb[1:3:1:1:1:4:1] | passed | 0.00128 seconds |
|
166
|
-
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:1:1] | passed | 0.00013 seconds |
|
167
|
-
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:2:1] | passed | 0.00011 seconds |
|
168
|
-
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:2:2:1:1:1] | passed | 0.00014 seconds |
|
169
|
-
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:2:2:1:1:2] | passed | 0.00014 seconds |
|
170
|
-
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:2:2:2:1:1:1] | passed | 0.00024 seconds |
|
171
|
-
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:2:2:2:1:1:2] | passed | 0.00058 seconds |
|
172
|
-
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:2:2:2:1:1:3] | passed | 0.00054 seconds |
|
173
|
-
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:2:2:2:1:1:4:1] | passed | 0.00129 seconds |
|
174
|
-
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:2:2:2:2:1:1] | passed | 0.0004 seconds |
|
175
|
-
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:2:2:2:2:1:2] | passed | 0.00102 seconds |
|
176
|
-
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:2:2:2:2:1:3] | passed | 0.00107 seconds |
|
177
|
-
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:2:2:2:2:1:4:1] | passed | 0.00153 seconds |
|
178
|
-
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:3:1] | passed | 0.00015 seconds |
|
179
|
-
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:3:2:1:1:1] | passed | 0.00015 seconds |
|
180
|
-
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:3:2:1:1:2] | passed | 0.00022 seconds |
|
181
|
-
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:3:2:2:1:1:1] | passed | 0.00018 seconds |
|
182
|
-
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:3:2:2:1:1:2] | passed | 0.00044 seconds |
|
183
|
-
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:3:2:2:1:1:3] | passed | 0.00056 seconds |
|
184
|
-
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:3:2:2:1:1:4:1] | passed | 0.00114 seconds |
|
185
|
-
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:3:2:2:2:1:1] | passed | 0.00021 seconds |
|
186
|
-
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:3:2:2:2:1:2] | passed | 0.0014 seconds |
|
187
|
-
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:3:2:2:2:1:3] | passed | 0.00064 seconds |
|
188
|
-
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:3:2:2:2:1:4:1] | passed | 0.0013 seconds |
|
189
|
-
./spec/defra_ruby/validators_spec.rb[1:1:1] | passed | 0.00414 seconds |
|
data/spec/spec_helper.rb
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
|
5
|
-
# Require and run our simplecov initializer as the very first thing we do.
|
6
|
-
# This is as per its docs https://github.com/colszowka/simplecov#getting-started
|
7
|
-
require "./spec/support/simplecov"
|
8
|
-
|
9
|
-
# Load env vars from a text file. This must be done before we load the other
|
10
|
-
# support files as some of them rely on the env vars being set.
|
11
|
-
require "dotenv/load"
|
12
|
-
|
13
|
-
# Requires supporting ruby files with custom matchers and macros, etc, in
|
14
|
-
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
15
|
-
# run as spec files by default. This means that files in spec/support that end
|
16
|
-
# in _spec.rb will both be required and run as specs, causing the specs to be
|
17
|
-
# run twice. It is recommended that you do not name files matching this glob to
|
18
|
-
# end with _spec.rb. You can configure this pattern with the --pattern
|
19
|
-
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
20
|
-
#
|
21
|
-
# We make an exception for simplecov because that will already have been
|
22
|
-
# required and run at the very top of spec_helper.rb
|
23
|
-
support_files = Dir["./spec/support/**/*.rb"].reject { |file| file == "./spec/support/simplecov.rb" }
|
24
|
-
support_files.each { |f| require f }
|
25
|
-
|
26
|
-
RSpec.configure do |config|
|
27
|
-
# rspec-expectations config goes here. You can use an alternate
|
28
|
-
# assertion/expectation library such as wrong or the stdlib/minitest
|
29
|
-
# assertions if you prefer.
|
30
|
-
config.expect_with :rspec do |expectations|
|
31
|
-
# This option will default to `true` in RSpec 4. It makes the `description`
|
32
|
-
# and `failure_message` of custom matchers include text for helper methods
|
33
|
-
# defined using `chain`, e.g.:
|
34
|
-
# be_bigger_than(2).and_smaller_than(4).description
|
35
|
-
# # => "be bigger than 2 and smaller than 4"
|
36
|
-
# ...rather than:
|
37
|
-
# # => "be bigger than 2"
|
38
|
-
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
39
|
-
end
|
40
|
-
|
41
|
-
# rspec-mocks config goes here. You can use an alternate test double
|
42
|
-
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
43
|
-
config.mock_with :rspec do |mocks|
|
44
|
-
# Prevents you from mocking or stubbing a method that does not exist on
|
45
|
-
# a real object. This is generally recommended, and will default to
|
46
|
-
# `true` in RSpec 4.
|
47
|
-
mocks.verify_partial_doubles = true
|
48
|
-
end
|
49
|
-
|
50
|
-
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
51
|
-
# have no way to turn it off -- the option exists only for backwards
|
52
|
-
# compatibility in RSpec 3). It causes shared context metadata to be
|
53
|
-
# inherited by the metadata hash of host groups and examples, rather than
|
54
|
-
# triggering implicit auto-inclusion in groups with matching metadata.
|
55
|
-
config.shared_context_metadata_behavior = :apply_to_host_groups
|
56
|
-
|
57
|
-
# This allows you to limit a spec run to individual examples or groups
|
58
|
-
# you care about by tagging them with `:focus` metadata. When nothing
|
59
|
-
# is tagged with `:focus`, all examples get run. RSpec also provides
|
60
|
-
# aliases for `it`, `describe`, and `context` that include `:focus`
|
61
|
-
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
62
|
-
config.filter_run_when_matching :focus
|
63
|
-
|
64
|
-
# Allows RSpec to persist some state between runs in order to support
|
65
|
-
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
66
|
-
# you configure your source control system to ignore this file.
|
67
|
-
config.example_status_persistence_file_path = "spec/examples.txt"
|
68
|
-
|
69
|
-
# Limits the available syntax to the non-monkey patched syntax that is
|
70
|
-
# recommended. For more details, see:
|
71
|
-
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
72
|
-
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
73
|
-
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
74
|
-
config.disable_monkey_patching!
|
75
|
-
|
76
|
-
# Run specs in random order to surface order dependencies. If you find an
|
77
|
-
# order dependency and want to debug it, you can fix the order by providing
|
78
|
-
# the seed, which is printed after each run.
|
79
|
-
# --seed 1234
|
80
|
-
config.order = :random
|
81
|
-
|
82
|
-
# Seed global randomization in this process using the `--seed` CLI option.
|
83
|
-
# Setting this allows you to use `--seed` to deterministically reproduce
|
84
|
-
# test failures related to randomization by passing the same `--seed` value
|
85
|
-
# as the one that triggered the failure.
|
86
|
-
Kernel.srand config.seed
|
87
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Need to require our actual code files. We don't just require everything in
|
4
|
-
# lib/defra_ruby because it contains the engine file which has a dependency on
|
5
|
-
# rails. We don't have that as a dependency of this project because it is
|
6
|
-
# a given this will be used in a rails project. So instead we require the
|
7
|
-
# validators file directly to load the content covered by our tests.
|
8
|
-
require "defra_ruby/validators"
|
9
|
-
|
10
|
-
DefraRuby::Validators.configure do |c|
|
11
|
-
def raise_missing_env_var(variable)
|
12
|
-
raise("Environment variable #{variable} has not been set")
|
13
|
-
end
|
14
|
-
|
15
|
-
c.companies_house_api_key = (ENV["COMPANIES_HOUSE_API_KEY"] || raise_missing_env_var("COMPANIES_HOUSE_API_KEY"))
|
16
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Helpers
|
4
|
-
module TextGenerator
|
5
|
-
def self.random_string(length)
|
6
|
-
random_string_from_sequence([("a".."z"), ("A".."Z")].map(&:to_a).flatten, length)
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.random_number_string(length)
|
10
|
-
random_string_from_sequence(("0".."9").to_a, length)
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.random_string_from_sequence(sequence, length)
|
14
|
-
(0...length).map { sequence[rand(sequence.length)] }.join
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Helpers
|
4
|
-
module Translator
|
5
|
-
def self.error_message(klass, error)
|
6
|
-
class_name = klass_name(klass)
|
7
|
-
|
8
|
-
I18n.t("defra_ruby.validators.#{class_name}.#{error}")
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.klass_name(klass)
|
12
|
-
klass.name.split("::").last
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
data/spec/support/i18n.rb
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Support using the locale files within our tests (else we'd rely on loading the
|
4
|
-
# gem in a rails app to confirm these are being pulled through correctly.)
|
5
|
-
require "i18n"
|
6
|
-
|
7
|
-
I18n.load_path << Dir["#{File.expand_path('config/locales')}/**/*.yml"]
|
8
|
-
I18n.default_locale = :en
|
data/spec/support/pry.rb
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Support debugging in the tests. Add `binding.pry` wherever you want execution
|
4
|
-
# to stop and the debugger to kick in.
|
5
|
-
# Details on the debugging commands can be found here
|
6
|
-
# https://github.com/deivid-rodriguez/pry-byebug#commands
|
7
|
-
require "pry-byebug"
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.shared_examples "a characters validator" do |validator, validatable_class, attribute, values|
|
4
|
-
it "includes CanValidateCharacters" do
|
5
|
-
included_modules = described_class.ancestors.select { |ancestor| ancestor.instance_of?(Module) }
|
6
|
-
|
7
|
-
expect(included_modules)
|
8
|
-
.to include(DefraRuby::Validators::CanValidateCharacters)
|
9
|
-
end
|
10
|
-
|
11
|
-
describe "#validate_each" do
|
12
|
-
context "when the #{attribute} is valid" do
|
13
|
-
it_behaves_like "a valid record", validatable_class.new(values[:valid])
|
14
|
-
end
|
15
|
-
|
16
|
-
context "when the #{attribute} is not valid" do
|
17
|
-
context "because the #{attribute} is not correctly formatted" do
|
18
|
-
validatable = validatable_class.new(values[:invalid])
|
19
|
-
error_message = Helpers::Translator.error_message(validator, :invalid_format)
|
20
|
-
|
21
|
-
it_behaves_like "an invalid record",
|
22
|
-
validatable: validatable,
|
23
|
-
attribute: attribute,
|
24
|
-
error: :invalid_format,
|
25
|
-
error_message: error_message
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.shared_examples "an invalid record" do |validatable:, attribute:, error:, error_message:|
|
4
|
-
it "confirms the object is invalid" do
|
5
|
-
expect(validatable).to_not be_valid
|
6
|
-
end
|
7
|
-
|
8
|
-
it "adds a single validation error to the record" do
|
9
|
-
validatable.valid?
|
10
|
-
expect(validatable.errors[attribute].count).to eq(1)
|
11
|
-
end
|
12
|
-
|
13
|
-
it "adds an appropriate validation error" do
|
14
|
-
validatable.valid?
|
15
|
-
expect(error_message).to_not include("translation missing:")
|
16
|
-
expect(validatable.errors[attribute]).to eq([error_message])
|
17
|
-
end
|
18
|
-
|
19
|
-
context "when there are custom error messages" do
|
20
|
-
let(:custom_message) { "something is wrong (in a customised way)" }
|
21
|
-
let(:messages) { { error => custom_message } }
|
22
|
-
before { allow_any_instance_of(DefraRuby::Validators::BaseValidator).to receive(:options).and_return(messages: messages) }
|
23
|
-
|
24
|
-
it "uses the custom message instead of the default" do
|
25
|
-
validatable.valid?
|
26
|
-
expect(validatable.errors[attribute]).to eq([custom_message])
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.shared_examples "a length validator" do |validator, validatable_class, attribute, values|
|
4
|
-
it "includes CanValidateLength" do
|
5
|
-
included_modules = described_class.ancestors.select { |ancestor| ancestor.instance_of?(Module) }
|
6
|
-
|
7
|
-
expect(included_modules)
|
8
|
-
.to include(DefraRuby::Validators::CanValidateLength)
|
9
|
-
end
|
10
|
-
|
11
|
-
describe "#validate_each" do
|
12
|
-
context "when the #{attribute} is valid" do
|
13
|
-
it_behaves_like "a valid record", validatable_class.new(values[:valid])
|
14
|
-
end
|
15
|
-
|
16
|
-
context "when the #{attribute} is not valid" do
|
17
|
-
context "because the #{attribute} is too long" do
|
18
|
-
validatable = validatable_class.new(values[:invalid])
|
19
|
-
error_message = Helpers::Translator.error_message(validator, :too_long)
|
20
|
-
|
21
|
-
it_behaves_like "an invalid record",
|
22
|
-
validatable: validatable,
|
23
|
-
attribute: attribute,
|
24
|
-
error: :too_long,
|
25
|
-
error_message: error_message
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.shared_examples "a presence validator" do |validator, validatable_class, attribute, values|
|
4
|
-
it "includes CanValidatePresence" do
|
5
|
-
included_modules = described_class.ancestors.select { |ancestor| ancestor.instance_of?(Module) }
|
6
|
-
|
7
|
-
expect(included_modules)
|
8
|
-
.to include(DefraRuby::Validators::CanValidatePresence)
|
9
|
-
end
|
10
|
-
|
11
|
-
describe "#validate_each" do
|
12
|
-
context "when the #{attribute} is valid" do
|
13
|
-
it_behaves_like "a valid record", validatable_class.new(values[:valid])
|
14
|
-
end
|
15
|
-
|
16
|
-
context "when the #{attribute} is not valid" do
|
17
|
-
context "because the #{attribute} is not present" do
|
18
|
-
validatable = validatable_class.new
|
19
|
-
error_message = Helpers::Translator.error_message(validator, :blank)
|
20
|
-
|
21
|
-
it_behaves_like "an invalid record",
|
22
|
-
validatable: validatable,
|
23
|
-
attribute: attribute,
|
24
|
-
error: :blank,
|
25
|
-
error_message: error_message
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.shared_examples "a selection validator" do |validator, validatable_class, attribute, values|
|
4
|
-
it "includes CanValidateSelection" do
|
5
|
-
included_modules = described_class.ancestors.select { |ancestor| ancestor.instance_of?(Module) }
|
6
|
-
|
7
|
-
expect(included_modules)
|
8
|
-
.to include(DefraRuby::Validators::CanValidateSelection)
|
9
|
-
end
|
10
|
-
|
11
|
-
describe "#validate_each" do
|
12
|
-
context "when the #{attribute} is valid" do
|
13
|
-
it_behaves_like "a valid record", validatable_class.new(values[:valid])
|
14
|
-
end
|
15
|
-
|
16
|
-
context "when the #{attribute} is not valid" do
|
17
|
-
context "because the #{attribute} is not present" do
|
18
|
-
validatable = validatable_class.new
|
19
|
-
error_message = Helpers::Translator.error_message(validator, :inclusion)
|
20
|
-
|
21
|
-
it_behaves_like "an invalid record",
|
22
|
-
validatable: validatable,
|
23
|
-
attribute: attribute,
|
24
|
-
error: :inclusion,
|
25
|
-
error_message: error_message
|
26
|
-
end
|
27
|
-
|
28
|
-
context "because the #{attribute} is not from an approved list" do
|
29
|
-
validatable = validatable_class.new(values[:invalid])
|
30
|
-
error_message = Helpers::Translator.error_message(validator, :inclusion)
|
31
|
-
|
32
|
-
it_behaves_like "an invalid record",
|
33
|
-
validatable: validatable,
|
34
|
-
attribute: attribute,
|
35
|
-
error: :inclusion,
|
36
|
-
error_message: error_message
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.shared_examples "a valid record" do |validatable|
|
4
|
-
it "confirms the object is valid" do
|
5
|
-
expect(validatable).to be_valid
|
6
|
-
end
|
7
|
-
|
8
|
-
it "the errors are empty" do
|
9
|
-
validatable.valid?
|
10
|
-
expect(validatable.errors).to be_empty
|
11
|
-
end
|
12
|
-
end
|
data/spec/support/simplecov.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "simplecov"
|
4
|
-
|
5
|
-
# We start it with the rails param to ensure it includes coverage for all code
|
6
|
-
# started by the rails app, and not just the files touched by our unit tests.
|
7
|
-
# This gives us the most accurate assessment of our unit test coverage
|
8
|
-
# https://github.com/colszowka/simplecov#getting-started
|
9
|
-
SimpleCov.start do
|
10
|
-
# We filter the spec folder, mainly to ensure that any dummy apps don't get
|
11
|
-
# included in the coverage report. However our intent is that nothing in the
|
12
|
-
# spec folder should be included
|
13
|
-
add_filter "/spec/"
|
14
|
-
# The version file is simply just that, so we do not feel the need to ensure
|
15
|
-
# we have a test for it
|
16
|
-
add_filter "lib/defra_ruby/validators/version"
|
17
|
-
end
|