defra_ruby_validators 2.1.1 → 2.1.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/config/locales/defra_ruby/validators/business_type_validator/en.yml +1 -2
- data/config/locales/defra_ruby/validators/companies_house_number_validator/en.yml +5 -6
- data/config/locales/defra_ruby/validators/email_validator/en.yml +2 -3
- data/config/locales/defra_ruby/validators/grid_reference_validator/en.yml +3 -4
- data/config/locales/defra_ruby/validators/location_validator/en.yml +1 -2
- data/config/locales/defra_ruby/validators/phone_number_validator/en.yml +3 -4
- data/config/locales/defra_ruby/validators/position_validator/en.yml +2 -3
- data/config/locales/defra_ruby/validators/token_validator/en.yml +2 -3
- data/config/locales/defra_ruby/validators/true_false_validator/en.yml +1 -2
- data/lib/defra_ruby/validators/base_validator.rb +2 -2
- data/lib/defra_ruby/validators/companies_house_number_validator.rb +5 -5
- data/lib/defra_ruby/validators/concerns/can_validate_characters.rb +1 -1
- data/lib/defra_ruby/validators/concerns/can_validate_length.rb +1 -1
- data/lib/defra_ruby/validators/concerns/can_validate_presence.rb +1 -1
- data/lib/defra_ruby/validators/concerns/can_validate_selection.rb +1 -1
- data/lib/defra_ruby/validators/email_validator.rb +1 -1
- data/lib/defra_ruby/validators/grid_reference_validator.rb +2 -2
- data/lib/defra_ruby/validators/phone_number_validator.rb +1 -1
- data/lib/defra_ruby/validators/token_validator.rb +1 -1
- data/lib/defra_ruby/validators/version.rb +1 -1
- data/spec/defra_ruby/validators/business_type_validator_spec.rb +1 -1
- data/spec/defra_ruby/validators/companies_house_number_validator_spec.rb +5 -25
- data/spec/defra_ruby/validators/email_validator_spec.rb +1 -1
- data/spec/defra_ruby/validators/grid_reference_validator_spec.rb +2 -2
- data/spec/defra_ruby/validators/location_validator_spec.rb +1 -1
- data/spec/defra_ruby/validators/phone_number_validator_spec.rb +1 -1
- data/spec/defra_ruby/validators/token_validator_spec.rb +1 -1
- data/spec/examples.txt +165 -81
- data/spec/support/helpers/translator.rb +2 -2
- data/spec/support/shared_examples/validators/characters_validator.rb +1 -1
- data/spec/support/shared_examples/validators/length_validator.rb +1 -1
- data/spec/support/shared_examples/validators/presence_validator.rb +1 -1
- data/spec/support/shared_examples/validators/selection_validator.rb +2 -2
- metadata +20 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2d6572ea54334edce203a7aa2bd925991e39704
|
4
|
+
data.tar.gz: 6902560347d17edca0edb89944068a5d284eb33e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8b16fb07610e2baf7ffb60c610031961448db71c6a0e99accd21081bfcd611c01fa13f8016f5965a5b194a16ed959e5402ad6c109e916ee8512f1ef5de26a6d
|
7
|
+
data.tar.gz: 410322d7defe820220ba9a51a1caa079f841d3823fad439b7b93e1828d5d4eef32bbb4a338fad98c91a022be8535535686f1854f2855a62ddf5e782044300857
|
@@ -2,9 +2,8 @@ en:
|
|
2
2
|
defra_ruby:
|
3
3
|
validators:
|
4
4
|
CompaniesHouseNumberValidator:
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
error: There was an error connecting with Companies House. Hopefully this is a one off and will work if you try again.
|
5
|
+
blank: Enter a company registration number
|
6
|
+
invalid_format: "Enter a valid number - it should have 8 digits, or 2 letters followed by 6 digits, or 2 letters followed by 5 digits and another letter. If your number has only 7 digits, enter it with a zero at the start."
|
7
|
+
not_found: Companies House couldn't find a company with this number
|
8
|
+
inactive: Your company must be registered as an active company
|
9
|
+
error: There was an error connecting with Companies House. Hopefully this is a one off and will work if you try again.
|
@@ -2,6 +2,5 @@ en:
|
|
2
2
|
defra_ruby:
|
3
3
|
validators:
|
4
4
|
EmailValidator:
|
5
|
-
email
|
6
|
-
|
7
|
-
invalid_format: "Enter a valid email address - there’s a mistake in that one"
|
5
|
+
blank: "Enter an email address"
|
6
|
+
invalid_format: "Enter a valid email address - there’s a mistake in that one"
|
@@ -2,7 +2,6 @@ en:
|
|
2
2
|
defra_ruby:
|
3
3
|
validators:
|
4
4
|
GridReferenceValidator:
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
invalid: The grid reference is not a valid coordinate
|
5
|
+
blank: Enter a grid reference
|
6
|
+
invalid_format: The grid reference should have 2 letters and 10 digits
|
7
|
+
invalid: The grid reference is not a valid coordinate
|
@@ -2,7 +2,6 @@ en:
|
|
2
2
|
defra_ruby:
|
3
3
|
validators:
|
4
4
|
PhoneNumberValidator:
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
too_long: "Check the number you entered - it should have no more than than 15 characters"
|
5
|
+
blank: "Enter a telephone number"
|
6
|
+
invalid_format: "Enter a valid telephone number"
|
7
|
+
too_long: "Check the number you entered - it should have no more than than 15 characters"
|
@@ -2,6 +2,5 @@ en:
|
|
2
2
|
defra_ruby:
|
3
3
|
validators:
|
4
4
|
PositionValidator:
|
5
|
-
position
|
6
|
-
|
7
|
-
too_long: "The position must have no more than 70 characters"
|
5
|
+
invalid_format: "The position must contain only letters, spaces, commas, full stops, hyphens and apostrophes"
|
6
|
+
too_long: "The position must have no more than 70 characters"
|
@@ -6,11 +6,11 @@ module DefraRuby
|
|
6
6
|
|
7
7
|
protected
|
8
8
|
|
9
|
-
def error_message(
|
9
|
+
def error_message(error)
|
10
10
|
if options[:messages] && options[:messages][error]
|
11
11
|
options[:messages][error]
|
12
12
|
else
|
13
|
-
I18n.t("defra_ruby.validators.#{class_name}.#{
|
13
|
+
I18n.t("defra_ruby.validators.#{class_name}.#{error}")
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -25,14 +25,14 @@ module DefraRuby
|
|
25
25
|
def value_is_present?(record, attribute, value)
|
26
26
|
return true if value.present?
|
27
27
|
|
28
|
-
record.errors[attribute] << error_message(:
|
28
|
+
record.errors[attribute] << error_message(:blank)
|
29
29
|
false
|
30
30
|
end
|
31
31
|
|
32
32
|
def format_is_valid?(record, attribute, value)
|
33
33
|
return true if value.match?(VALID_COMPANIES_HOUSE_REGISTRATION_NUMBER_REGEX)
|
34
34
|
|
35
|
-
record.errors[attribute] << error_message(:
|
35
|
+
record.errors[attribute] << error_message(:invalid_format)
|
36
36
|
false
|
37
37
|
end
|
38
38
|
|
@@ -41,12 +41,12 @@ module DefraRuby
|
|
41
41
|
when :active
|
42
42
|
true
|
43
43
|
when :inactive
|
44
|
-
record.errors[attribute] << error_message(:
|
44
|
+
record.errors[attribute] << error_message(:inactive)
|
45
45
|
when :not_found
|
46
|
-
record.errors[attribute] << error_message(:
|
46
|
+
record.errors[attribute] << error_message(:not_found)
|
47
47
|
end
|
48
48
|
rescue StandardError
|
49
|
-
record.errors[attribute] << error_message(:
|
49
|
+
record.errors[attribute] << error_message(:error)
|
50
50
|
end
|
51
51
|
|
52
52
|
end
|
@@ -10,7 +10,7 @@ module DefraRuby
|
|
10
10
|
# Name fields must contain only letters, spaces, commas, full stops, hyphens and apostrophes
|
11
11
|
return true if value.match?(/\A[-a-z\s,.']+\z/i)
|
12
12
|
|
13
|
-
record.errors[attribute] << error_message(
|
13
|
+
record.errors[attribute] << error_message(:invalid_format)
|
14
14
|
false
|
15
15
|
end
|
16
16
|
|
@@ -9,7 +9,7 @@ module DefraRuby
|
|
9
9
|
def value_is_not_too_long?(record, attribute, value, max_length)
|
10
10
|
return true if value.length <= max_length
|
11
11
|
|
12
|
-
record.errors[attribute] << error_message(
|
12
|
+
record.errors[attribute] << error_message(:too_long)
|
13
13
|
false
|
14
14
|
end
|
15
15
|
|
@@ -9,7 +9,7 @@ module DefraRuby
|
|
9
9
|
def value_is_included?(record, attribute, value, valid_options)
|
10
10
|
return true if value.present? && valid_options.include?(value)
|
11
11
|
|
12
|
-
record.errors[attribute] << error_message(
|
12
|
+
record.errors[attribute] << error_message(:inclusion)
|
13
13
|
false
|
14
14
|
end
|
15
15
|
|
@@ -19,7 +19,7 @@ module DefraRuby
|
|
19
19
|
# validate_email_format returns nil if the validation passes
|
20
20
|
return true unless ValidatesEmailFormatOf.validate_email_format(value)
|
21
21
|
|
22
|
-
record.errors[attribute] << error_message(:
|
22
|
+
record.errors[attribute] << error_message(:invalid_format)
|
23
23
|
false
|
24
24
|
end
|
25
25
|
|
@@ -22,7 +22,7 @@ module DefraRuby
|
|
22
22
|
def valid_format?(record, attribute, value)
|
23
23
|
return true if value.match?(/\A#{grid_reference_pattern}\z/)
|
24
24
|
|
25
|
-
record.errors[attribute] << error_message(:
|
25
|
+
record.errors[attribute] << error_message(:invalid_format)
|
26
26
|
false
|
27
27
|
end
|
28
28
|
|
@@ -30,7 +30,7 @@ module DefraRuby
|
|
30
30
|
OsMapRef::Location.for(value).easting
|
31
31
|
true
|
32
32
|
rescue OsMapRef::Error
|
33
|
-
record.errors[attribute] << error_message(:
|
33
|
+
record.errors[attribute] << error_message(:invalid)
|
34
34
|
false
|
35
35
|
end
|
36
36
|
|
@@ -42,7 +42,7 @@ module DefraRuby
|
|
42
42
|
allow_any_instance_of(DefraRuby::Validators::BaseValidator).to receive(:options).and_return({})
|
43
43
|
end
|
44
44
|
|
45
|
-
error_message = Helpers::Translator.error_message(BusinessTypeValidator, :
|
45
|
+
error_message = Helpers::Translator.error_message(BusinessTypeValidator, :inclusion)
|
46
46
|
|
47
47
|
it_behaves_like "an invalid record",
|
48
48
|
validatable: validatable,
|
@@ -37,11 +37,7 @@ module DefraRuby
|
|
37
37
|
context "when given an invalid company number" do
|
38
38
|
context "because it is blank" do
|
39
39
|
validatable = Test::CompaniesHouseNumberValidatable.new
|
40
|
-
error_message = Helpers::Translator.error_message(
|
41
|
-
CompaniesHouseNumberValidator,
|
42
|
-
:company_no,
|
43
|
-
:blank
|
44
|
-
)
|
40
|
+
error_message = Helpers::Translator.error_message(CompaniesHouseNumberValidator, :blank)
|
45
41
|
|
46
42
|
it_behaves_like "an invalid record",
|
47
43
|
validatable: validatable,
|
@@ -52,11 +48,7 @@ module DefraRuby
|
|
52
48
|
|
53
49
|
context "because the format is wrong" do
|
54
50
|
validatable = Test::CompaniesHouseNumberValidatable.new(invalid_format_number)
|
55
|
-
error_message = Helpers::Translator.error_message(
|
56
|
-
CompaniesHouseNumberValidator,
|
57
|
-
:company_no,
|
58
|
-
:invalid_format
|
59
|
-
)
|
51
|
+
error_message = Helpers::Translator.error_message(CompaniesHouseNumberValidator, :invalid_format)
|
60
52
|
|
61
53
|
it_behaves_like "an invalid record",
|
62
54
|
validatable: validatable,
|
@@ -71,11 +63,7 @@ module DefraRuby
|
|
71
63
|
end
|
72
64
|
|
73
65
|
validatable = Test::CompaniesHouseNumberValidatable.new(unknown_number)
|
74
|
-
error_message = Helpers::Translator.error_message(
|
75
|
-
CompaniesHouseNumberValidator,
|
76
|
-
:company_no,
|
77
|
-
:not_found
|
78
|
-
)
|
66
|
+
error_message = Helpers::Translator.error_message(CompaniesHouseNumberValidator, :not_found)
|
79
67
|
|
80
68
|
it_behaves_like "an invalid record",
|
81
69
|
validatable: validatable,
|
@@ -90,11 +78,7 @@ module DefraRuby
|
|
90
78
|
end
|
91
79
|
|
92
80
|
validatable = Test::CompaniesHouseNumberValidatable.new(inactive_number)
|
93
|
-
error_message = Helpers::Translator.error_message(
|
94
|
-
CompaniesHouseNumberValidator,
|
95
|
-
:company_no,
|
96
|
-
:inactive
|
97
|
-
)
|
81
|
+
error_message = Helpers::Translator.error_message(CompaniesHouseNumberValidator, :inactive)
|
98
82
|
|
99
83
|
it_behaves_like "an invalid record",
|
100
84
|
validatable: validatable,
|
@@ -110,11 +94,7 @@ module DefraRuby
|
|
110
94
|
end
|
111
95
|
|
112
96
|
validatable = Test::CompaniesHouseNumberValidatable.new(valid_numbers.sample)
|
113
|
-
error_message = Helpers::Translator.error_message(
|
114
|
-
CompaniesHouseNumberValidator,
|
115
|
-
:company_no,
|
116
|
-
:error
|
117
|
-
)
|
97
|
+
error_message = Helpers::Translator.error_message(CompaniesHouseNumberValidator, :error)
|
118
98
|
|
119
99
|
it_behaves_like "an invalid record",
|
120
100
|
validatable: validatable,
|
@@ -31,7 +31,7 @@ module DefraRuby
|
|
31
31
|
context "because the email is not correctly formatted" do
|
32
32
|
validatable = Test::EmailValidatable.new(invalid_email)
|
33
33
|
|
34
|
-
error_message = Helpers::Translator.error_message(EmailValidator, :
|
34
|
+
error_message = Helpers::Translator.error_message(EmailValidator, :invalid_format)
|
35
35
|
|
36
36
|
it_behaves_like "an invalid record",
|
37
37
|
validatable: validatable,
|
@@ -31,7 +31,7 @@ module DefraRuby
|
|
31
31
|
context "when the grid reference is not valid" do
|
32
32
|
context "because the grid reference is not correctly formatted" do
|
33
33
|
validatable = Test::GridReferenceValidatable.new(invalid_grid_reference)
|
34
|
-
error_message = Helpers::Translator.error_message(GridReferenceValidator, :
|
34
|
+
error_message = Helpers::Translator.error_message(GridReferenceValidator, :invalid_format)
|
35
35
|
|
36
36
|
it_behaves_like "an invalid record",
|
37
37
|
validatable: validatable,
|
@@ -42,7 +42,7 @@ module DefraRuby
|
|
42
42
|
|
43
43
|
context "because the grid reference is not a coordinate" do
|
44
44
|
validatable = Test::GridReferenceValidatable.new(non_coordinate_grid_reference)
|
45
|
-
error_message = Helpers::Translator.error_message(GridReferenceValidator, :
|
45
|
+
error_message = Helpers::Translator.error_message(GridReferenceValidator, :invalid)
|
46
46
|
|
47
47
|
it_behaves_like "an invalid record",
|
48
48
|
validatable: validatable,
|
@@ -42,7 +42,7 @@ module DefraRuby
|
|
42
42
|
allow_any_instance_of(DefraRuby::Validators::BaseValidator).to receive(:options).and_return({})
|
43
43
|
end
|
44
44
|
|
45
|
-
error_message = Helpers::Translator.error_message(LocationValidator, :
|
45
|
+
error_message = Helpers::Translator.error_message(LocationValidator, :inclusion)
|
46
46
|
|
47
47
|
it_behaves_like "an invalid record",
|
48
48
|
validatable: validatable,
|
@@ -44,7 +44,7 @@ module DefraRuby
|
|
44
44
|
context "when the phone number is not valid" do
|
45
45
|
context "because the phone number is not correctly formatted" do
|
46
46
|
validatable = Test::PhoneNumberValidatable.new(invalid_number)
|
47
|
-
error_message = Helpers::Translator.error_message(PhoneNumberValidator, :
|
47
|
+
error_message = Helpers::Translator.error_message(PhoneNumberValidator, :invalid_format)
|
48
48
|
|
49
49
|
it_behaves_like "an invalid record",
|
50
50
|
validatable: validatable,
|
@@ -30,7 +30,7 @@ module DefraRuby
|
|
30
30
|
context "when the token is not valid" do
|
31
31
|
context "because the token is not correctly formatted" do
|
32
32
|
validatable = Test::TokenValidatable.new(invalid_token)
|
33
|
-
error_message = Helpers::Translator.error_message(TokenValidator, :
|
33
|
+
error_message = Helpers::Translator.error_message(TokenValidator, :invalid_format)
|
34
34
|
|
35
35
|
it_behaves_like "an invalid record",
|
36
36
|
validatable: validatable,
|
data/spec/examples.txt
CHANGED
@@ -1,81 +1,165 @@
|
|
1
|
-
example_id
|
2
|
-
|
3
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:1:1]
|
4
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:1]
|
5
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:1:1:1]
|
6
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:1:1:2]
|
7
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:2:1:1:1]
|
8
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:2:1:1:2]
|
9
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:2:1:1:3]
|
10
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:2:
|
11
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:2:2:1:
|
12
|
-
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:2:2:1:
|
13
|
-
./spec/defra_ruby/validators/
|
14
|
-
./spec/defra_ruby/validators/
|
15
|
-
./spec/defra_ruby/validators/
|
16
|
-
./spec/defra_ruby/validators/
|
17
|
-
./spec/defra_ruby/validators/
|
18
|
-
./spec/defra_ruby/validators/
|
19
|
-
./spec/defra_ruby/validators/
|
20
|
-
./spec/defra_ruby/validators/
|
21
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:
|
22
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:
|
23
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:
|
24
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:1:1
|
25
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:
|
26
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:
|
27
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:
|
28
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:
|
29
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:
|
30
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:
|
31
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:
|
32
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:
|
33
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:4:1
|
34
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:
|
35
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:
|
36
|
-
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:
|
37
|
-
./spec/defra_ruby/validators/
|
38
|
-
./spec/defra_ruby/validators/
|
39
|
-
./spec/defra_ruby/validators/
|
40
|
-
./spec/defra_ruby/validators/
|
41
|
-
./spec/defra_ruby/validators/
|
42
|
-
./spec/defra_ruby/validators/
|
43
|
-
./spec/defra_ruby/validators/
|
44
|
-
./spec/defra_ruby/validators/
|
45
|
-
./spec/defra_ruby/validators/
|
46
|
-
./spec/defra_ruby/validators/
|
47
|
-
./spec/defra_ruby/validators/
|
48
|
-
./spec/defra_ruby/validators/
|
49
|
-
./spec/defra_ruby/validators/
|
50
|
-
./spec/defra_ruby/validators/
|
51
|
-
./spec/defra_ruby/validators/
|
52
|
-
./spec/defra_ruby/validators/
|
53
|
-
./spec/defra_ruby/validators/
|
54
|
-
./spec/defra_ruby/validators/
|
55
|
-
./spec/defra_ruby/validators/
|
56
|
-
./spec/defra_ruby/validators/
|
57
|
-
./spec/defra_ruby/validators/
|
58
|
-
./spec/defra_ruby/validators/
|
59
|
-
./spec/defra_ruby/validators/
|
60
|
-
./spec/defra_ruby/validators/
|
61
|
-
./spec/defra_ruby/validators/
|
62
|
-
./spec/defra_ruby/validators/
|
63
|
-
./spec/defra_ruby/validators/
|
64
|
-
./spec/defra_ruby/validators/
|
65
|
-
./spec/defra_ruby/validators/
|
66
|
-
./spec/defra_ruby/validators/
|
67
|
-
./spec/defra_ruby/validators/
|
68
|
-
./spec/defra_ruby/validators/
|
69
|
-
./spec/defra_ruby/validators/
|
70
|
-
./spec/defra_ruby/validators/
|
71
|
-
./spec/defra_ruby/validators/
|
72
|
-
./spec/defra_ruby/validators/
|
73
|
-
./spec/defra_ruby/validators/
|
74
|
-
./spec/defra_ruby/validators/
|
75
|
-
./spec/defra_ruby/validators/
|
76
|
-
./spec/defra_ruby/validators/
|
77
|
-
./spec/defra_ruby/validators/
|
78
|
-
./spec/defra_ruby/validators/
|
79
|
-
./spec/defra_ruby/validators/
|
80
|
-
./spec/defra_ruby/validators/
|
81
|
-
./spec/defra_ruby/
|
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.0001 seconds |
|
5
|
+
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:1:1:1] | passed | 0.00013 seconds |
|
6
|
+
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:1:1:2] | passed | 0.00018 seconds |
|
7
|
+
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:2:1:1:1] | passed | 0.00035 seconds |
|
8
|
+
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:2:1:1:2] | passed | 0.00016 seconds |
|
9
|
+
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:2:1:1:3] | passed | 0.00019 seconds |
|
10
|
+
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:2:1:1:4:1] | passed | 0.00213 seconds |
|
11
|
+
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:2:2:1:1] | passed | 0.00028 seconds |
|
12
|
+
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:2:2:1:2] | passed | 0.00022 seconds |
|
13
|
+
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:2:2:1:3] | passed | 0.00023 seconds |
|
14
|
+
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:2:2:2:2:1:4:1] | passed | 0.00096 seconds |
|
15
|
+
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:3:1:1:1] | passed | 0.00072 seconds |
|
16
|
+
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:3:1:1:2] | passed | 0.00071 seconds |
|
17
|
+
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:3:2:1:1] | passed | 0.00116 seconds |
|
18
|
+
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:3:2:1:2] | passed | 0.00108 seconds |
|
19
|
+
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:3:2:1:3] | passed | 0.00088 seconds |
|
20
|
+
./spec/defra_ruby/validators/business_type_validator_spec.rb[1:3:2:1:4:1] | passed | 0.00112 seconds |
|
21
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:1:1] | passed | 0.00012 seconds |
|
22
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:1:1:1:1] | passed | 0.00052 seconds |
|
23
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:1:1:1:2] | passed | 0.00057 seconds |
|
24
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:1:2:1:1] | passed | 0.00054 seconds |
|
25
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:1:2:1:2] | passed | 0.0007 seconds |
|
26
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:1:3:1:1] | passed | 0.00058 seconds |
|
27
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:1:3:1:2] | passed | 0.0005 seconds |
|
28
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:1:4:1:1] | passed | 0.00057 seconds |
|
29
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:1:4:1:2] | passed | 0.00073 seconds |
|
30
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:1:1:1] | passed | 0.00052 seconds |
|
31
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:1:1:2] | passed | 0.00034 seconds |
|
32
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:1:1:3] | passed | 0.00025 seconds |
|
33
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:1:1:4:1] | passed | 0.00168 seconds |
|
34
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:2:1:1] | passed | 0.0002 seconds |
|
35
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:2:1:2] | passed | 0.00015 seconds |
|
36
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:2:1:3] | passed | 0.0003 seconds |
|
37
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:2:1:4:1] | passed | 0.03648 seconds |
|
38
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:3:1:1] | passed | 0.00114 seconds |
|
39
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:3:1:2] | passed | 0.00075 seconds |
|
40
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:3:1:3] | passed | 0.00133 seconds |
|
41
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:3:1:4:1] | passed | 0.00224 seconds |
|
42
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:4:1:1] | passed | 0.00086 seconds |
|
43
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:4:1:2] | passed | 0.00091 seconds |
|
44
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:4:1:3] | passed | 0.00098 seconds |
|
45
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:2:4:1:4:1] | passed | 0.00104 seconds |
|
46
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:3:1:1] | passed | 0.00056 seconds |
|
47
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:3:1:2] | passed | 0.00069 seconds |
|
48
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:3:1:3] | passed | 0.00052 seconds |
|
49
|
+
./spec/defra_ruby/validators/companies_house_number_validator_spec.rb[1:2:3:1:4:1] | passed | 0.00374 seconds |
|
50
|
+
./spec/defra_ruby/validators/companies_house_service_spec.rb[1:1:1:1] | passed | 0.01591 seconds |
|
51
|
+
./spec/defra_ruby/validators/companies_house_service_spec.rb[1:1:2:1] | passed | 0.01718 seconds |
|
52
|
+
./spec/defra_ruby/validators/companies_house_service_spec.rb[1:1:3:1] | passed | 0.01637 seconds |
|
53
|
+
./spec/defra_ruby/validators/companies_house_service_spec.rb[1:1:4:1:1] | passed | 0.0254 seconds |
|
54
|
+
./spec/defra_ruby/validators/companies_house_service_spec.rb[1:1:4:2:1] | passed | 0.01415 seconds |
|
55
|
+
./spec/defra_ruby/validators/configuration_spec.rb[1:1:1] | passed | 0.00236 seconds |
|
56
|
+
./spec/defra_ruby/validators/configuration_spec.rb[1:2] | passed | 0.00013 seconds |
|
57
|
+
./spec/defra_ruby/validators/configuration_spec.rb[1:3:1:1] | passed | 0.00017 seconds |
|
58
|
+
./spec/defra_ruby/validators/configuration_spec.rb[1:3:2:1] | passed | 0.00018 seconds |
|
59
|
+
./spec/defra_ruby/validators/email_validator_spec.rb[1:1:1] | passed | 0.00013 seconds |
|
60
|
+
./spec/defra_ruby/validators/email_validator_spec.rb[1:2:1] | passed | 0.00011 seconds |
|
61
|
+
./spec/defra_ruby/validators/email_validator_spec.rb[1:2:2:1:1:1] | passed | 0.00041 seconds |
|
62
|
+
./spec/defra_ruby/validators/email_validator_spec.rb[1:2:2:1:1:2] | passed | 0.00025 seconds |
|
63
|
+
./spec/defra_ruby/validators/email_validator_spec.rb[1:2:2:2:1:1:1] | passed | 0.00026 seconds |
|
64
|
+
./spec/defra_ruby/validators/email_validator_spec.rb[1:2:2:2:1:1:2] | passed | 0.00017 seconds |
|
65
|
+
./spec/defra_ruby/validators/email_validator_spec.rb[1:2:2:2:1:1:3] | passed | 0.00022 seconds |
|
66
|
+
./spec/defra_ruby/validators/email_validator_spec.rb[1:2:2:2:1:1:4:1] | passed | 0.00083 seconds |
|
67
|
+
./spec/defra_ruby/validators/email_validator_spec.rb[1:3:1:1:1:1] | passed | 0.00033 seconds |
|
68
|
+
./spec/defra_ruby/validators/email_validator_spec.rb[1:3:1:1:1:2] | passed | 0.00026 seconds |
|
69
|
+
./spec/defra_ruby/validators/email_validator_spec.rb[1:3:1:1:1:3] | passed | 0.00029 seconds |
|
70
|
+
./spec/defra_ruby/validators/email_validator_spec.rb[1:3:1:1:1:4:1] | passed | 0.0008 seconds |
|
71
|
+
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:1:1] | passed | 0.00263 seconds |
|
72
|
+
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:2:1] | passed | 0.00035 seconds |
|
73
|
+
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:2:2:1:1:1] | passed | 0.0142 seconds |
|
74
|
+
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:2:2:1:1:2] | passed | 0.00033 seconds |
|
75
|
+
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:2:2:2:1:1:1] | passed | 0.00048 seconds |
|
76
|
+
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:2:2:2:1:1:2] | passed | 0.00143 seconds |
|
77
|
+
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:2:2:2:1:1:3] | passed | 0.00031 seconds |
|
78
|
+
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:2:2:2:1:1:4:1] | passed | 0.01478 seconds |
|
79
|
+
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:3:1:1:1:1] | passed | 0.00048 seconds |
|
80
|
+
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:3:1:1:1:2] | passed | 0.00025 seconds |
|
81
|
+
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:3:1:1:1:3] | passed | 0.00047 seconds |
|
82
|
+
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:3:1:1:1:4:1] | passed | 0.00102 seconds |
|
83
|
+
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:3:1:2:1:1] | passed | 0.0004 seconds |
|
84
|
+
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:3:1:2:1:2] | passed | 0.00071 seconds |
|
85
|
+
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:3:1:2:1:3] | passed | 0.00051 seconds |
|
86
|
+
./spec/defra_ruby/validators/grid_reference_validator_spec.rb[1:3:1:2:1:4:1] | passed | 0.00094 seconds |
|
87
|
+
./spec/defra_ruby/validators/location_validator_spec.rb[1:1:1] | passed | 0.00011 seconds |
|
88
|
+
./spec/defra_ruby/validators/location_validator_spec.rb[1:2:1] | passed | 0.00022 seconds |
|
89
|
+
./spec/defra_ruby/validators/location_validator_spec.rb[1:2:2:1:1:1] | passed | 0.00015 seconds |
|
90
|
+
./spec/defra_ruby/validators/location_validator_spec.rb[1:2:2:1:1:2] | passed | 0.0003 seconds |
|
91
|
+
./spec/defra_ruby/validators/location_validator_spec.rb[1:2:2:2:1:1:1] | passed | 0.00032 seconds |
|
92
|
+
./spec/defra_ruby/validators/location_validator_spec.rb[1:2:2:2:1:1:2] | passed | 0.00045 seconds |
|
93
|
+
./spec/defra_ruby/validators/location_validator_spec.rb[1:2:2:2:1:1:3] | passed | 0.00051 seconds |
|
94
|
+
./spec/defra_ruby/validators/location_validator_spec.rb[1:2:2:2:1:1:4:1] | passed | 0.0014 seconds |
|
95
|
+
./spec/defra_ruby/validators/location_validator_spec.rb[1:2:2:2:2:1:1] | passed | 0.00079 seconds |
|
96
|
+
./spec/defra_ruby/validators/location_validator_spec.rb[1:2:2:2:2:1:2] | passed | 0.00045 seconds |
|
97
|
+
./spec/defra_ruby/validators/location_validator_spec.rb[1:2:2:2:2:1:3] | passed | 0.00024 seconds |
|
98
|
+
./spec/defra_ruby/validators/location_validator_spec.rb[1:2:2:2:2:1:4:1] | passed | 0.00108 seconds |
|
99
|
+
./spec/defra_ruby/validators/location_validator_spec.rb[1:3:1:1:1] | passed | 0.00082 seconds |
|
100
|
+
./spec/defra_ruby/validators/location_validator_spec.rb[1:3:1:1:2] | passed | 0.00095 seconds |
|
101
|
+
./spec/defra_ruby/validators/location_validator_spec.rb[1:3:2:1:1] | passed | 0.0014 seconds |
|
102
|
+
./spec/defra_ruby/validators/location_validator_spec.rb[1:3:2:1:2] | passed | 0.00076 seconds |
|
103
|
+
./spec/defra_ruby/validators/location_validator_spec.rb[1:3:2:1:3] | passed | 0.00159 seconds |
|
104
|
+
./spec/defra_ruby/validators/location_validator_spec.rb[1:3:2:1:4:1] | passed | 0.00106 seconds |
|
105
|
+
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:1:1] | passed | 0.0004 seconds |
|
106
|
+
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:2:1] | passed | 0.00011 seconds |
|
107
|
+
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:2:2:1:1:1] | passed | 0.02939 seconds |
|
108
|
+
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:2:2:1:1:2] | passed | 0.00245 seconds |
|
109
|
+
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:2:2:2:1:1:1] | passed | 0.0002 seconds |
|
110
|
+
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:2:2:2:1:1:2] | passed | 0.00016 seconds |
|
111
|
+
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:2:2:2:1:1:3] | passed | 0.00025 seconds |
|
112
|
+
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:2:2:2:1:1:4:1] | passed | 0.00106 seconds |
|
113
|
+
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:3:1] | passed | 0.00029 seconds |
|
114
|
+
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:3:2:1:1:1] | passed | 0.00337 seconds |
|
115
|
+
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:3:2:1:1:2] | passed | 0.00438 seconds |
|
116
|
+
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:3:2:2:1:1:1] | passed | 0.00087 seconds |
|
117
|
+
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:3:2:2:1:1:2] | passed | 0.00026 seconds |
|
118
|
+
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:3:2:2:1:1:3] | passed | 0.00047 seconds |
|
119
|
+
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:3:2:2:1:1:4:1] | passed | 0.00126 seconds |
|
120
|
+
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:4:1:1:1:1] | passed | 0.00946 seconds |
|
121
|
+
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:4:1:1:1:2] | passed | 0.00035 seconds |
|
122
|
+
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:4:1:1:1:3] | passed | 0.0002 seconds |
|
123
|
+
./spec/defra_ruby/validators/phone_number_validator_spec.rb[1:4:1:1:1:4:1] | passed | 0.00084 seconds |
|
124
|
+
./spec/defra_ruby/validators/position_validator_spec.rb[1:1:1] | passed | 0.00011 seconds |
|
125
|
+
./spec/defra_ruby/validators/position_validator_spec.rb[1:2:1] | passed | 0.00012 seconds |
|
126
|
+
./spec/defra_ruby/validators/position_validator_spec.rb[1:2:2:1:1:1] | passed | 0.00021 seconds |
|
127
|
+
./spec/defra_ruby/validators/position_validator_spec.rb[1:2:2:1:1:2] | passed | 0.00024 seconds |
|
128
|
+
./spec/defra_ruby/validators/position_validator_spec.rb[1:2:2:2:1:1:1] | passed | 0.00034 seconds |
|
129
|
+
./spec/defra_ruby/validators/position_validator_spec.rb[1:2:2:2:1:1:2] | passed | 0.00018 seconds |
|
130
|
+
./spec/defra_ruby/validators/position_validator_spec.rb[1:2:2:2:1:1:3] | passed | 0.00027 seconds |
|
131
|
+
./spec/defra_ruby/validators/position_validator_spec.rb[1:2:2:2:1:1:4:1] | passed | 0.00155 seconds |
|
132
|
+
./spec/defra_ruby/validators/position_validator_spec.rb[1:3:1] | passed | 0.00011 seconds |
|
133
|
+
./spec/defra_ruby/validators/position_validator_spec.rb[1:3:2:1:1:1] | passed | 0.00014 seconds |
|
134
|
+
./spec/defra_ruby/validators/position_validator_spec.rb[1:3:2:1:1:2] | passed | 0.00022 seconds |
|
135
|
+
./spec/defra_ruby/validators/position_validator_spec.rb[1:3:2:2:1:1:1] | passed | 0.00037 seconds |
|
136
|
+
./spec/defra_ruby/validators/position_validator_spec.rb[1:3:2:2:1:1:2] | passed | 0.00068 seconds |
|
137
|
+
./spec/defra_ruby/validators/position_validator_spec.rb[1:3:2:2:1:1:3] | passed | 0.00025 seconds |
|
138
|
+
./spec/defra_ruby/validators/position_validator_spec.rb[1:3:2:2:1:1:4:1] | passed | 0.00106 seconds |
|
139
|
+
./spec/defra_ruby/validators/position_validator_spec.rb[1:4:1:1:1:1] | passed | 0.00057 seconds |
|
140
|
+
./spec/defra_ruby/validators/position_validator_spec.rb[1:4:1:1:1:2] | passed | 0.00016 seconds |
|
141
|
+
./spec/defra_ruby/validators/token_validator_spec.rb[1:1:1] | passed | 0.0008 seconds |
|
142
|
+
./spec/defra_ruby/validators/token_validator_spec.rb[1:2:1] | passed | 0.00014 seconds |
|
143
|
+
./spec/defra_ruby/validators/token_validator_spec.rb[1:2:2:1:1:1] | passed | 0.00037 seconds |
|
144
|
+
./spec/defra_ruby/validators/token_validator_spec.rb[1:2:2:1:1:2] | passed | 0.00017 seconds |
|
145
|
+
./spec/defra_ruby/validators/token_validator_spec.rb[1:2:2:2:1:1:1] | passed | 0.00051 seconds |
|
146
|
+
./spec/defra_ruby/validators/token_validator_spec.rb[1:2:2:2:1:1:2] | passed | 0.0002 seconds |
|
147
|
+
./spec/defra_ruby/validators/token_validator_spec.rb[1:2:2:2:1:1:3] | passed | 0.00019 seconds |
|
148
|
+
./spec/defra_ruby/validators/token_validator_spec.rb[1:2:2:2:1:1:4:1] | passed | 0.00129 seconds |
|
149
|
+
./spec/defra_ruby/validators/token_validator_spec.rb[1:3:1:1:1:1] | passed | 0.00018 seconds |
|
150
|
+
./spec/defra_ruby/validators/token_validator_spec.rb[1:3:1:1:1:2] | passed | 0.00019 seconds |
|
151
|
+
./spec/defra_ruby/validators/token_validator_spec.rb[1:3:1:1:1:3] | passed | 0.00019 seconds |
|
152
|
+
./spec/defra_ruby/validators/token_validator_spec.rb[1:3:1:1:1:4:1] | passed | 0.00109 seconds |
|
153
|
+
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:1:1] | passed | 0.0001 seconds |
|
154
|
+
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:2:1] | passed | 0.00012 seconds |
|
155
|
+
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:2:2:1:1:1] | passed | 0.00033 seconds |
|
156
|
+
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:2:2:1:1:2] | passed | 0.00019 seconds |
|
157
|
+
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:2:2:2:1:1:1] | passed | 0.0002 seconds |
|
158
|
+
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:2:2:2:1:1:2] | passed | 0.00017 seconds |
|
159
|
+
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:2:2:2:1:1:3] | passed | 0.00026 seconds |
|
160
|
+
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:2:2:2:1:1:4:1] | passed | 0.00118 seconds |
|
161
|
+
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:2:2:2:2:1:1] | passed | 0.00042 seconds |
|
162
|
+
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:2:2:2:2:1:2] | passed | 0.00017 seconds |
|
163
|
+
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:2:2:2:2:1:3] | passed | 0.00024 seconds |
|
164
|
+
./spec/defra_ruby/validators/true_false_validator_spec.rb[1:2:2:2:2:1:4:1] | passed | 0.00116 seconds |
|
165
|
+
./spec/defra_ruby/validators_spec.rb[1:1:1] | passed | 0.00221 seconds |
|
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
module Helpers
|
4
4
|
module Translator
|
5
|
-
def self.error_message(klass,
|
5
|
+
def self.error_message(klass, error)
|
6
6
|
class_name = klass_name(klass)
|
7
7
|
|
8
|
-
I18n.t("defra_ruby.validators.#{class_name}.#{
|
8
|
+
I18n.t("defra_ruby.validators.#{class_name}.#{error}")
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.klass_name(klass)
|
@@ -16,7 +16,7 @@ RSpec.shared_examples "a characters validator" do |validator, validatable_class,
|
|
16
16
|
context "when the #{attribute} is not valid" do
|
17
17
|
context "because the #{attribute} is not correctly formatted" do
|
18
18
|
validatable = validatable_class.new(values[:invalid])
|
19
|
-
error_message = Helpers::Translator.error_message(validator,
|
19
|
+
error_message = Helpers::Translator.error_message(validator, :invalid_format)
|
20
20
|
|
21
21
|
it_behaves_like "an invalid record",
|
22
22
|
validatable: validatable,
|
@@ -16,7 +16,7 @@ RSpec.shared_examples "a length validator" do |validator, validatable_class, att
|
|
16
16
|
context "when the #{attribute} is not valid" do
|
17
17
|
context "because the #{attribute} is too long" do
|
18
18
|
validatable = validatable_class.new(values[:invalid])
|
19
|
-
error_message = Helpers::Translator.error_message(validator,
|
19
|
+
error_message = Helpers::Translator.error_message(validator, :too_long)
|
20
20
|
|
21
21
|
it_behaves_like "an invalid record",
|
22
22
|
validatable: validatable,
|
@@ -16,7 +16,7 @@ RSpec.shared_examples "a presence validator" do |validator, validatable_class, a
|
|
16
16
|
context "when the #{attribute} is not valid" do
|
17
17
|
context "because the #{attribute} is not present" do
|
18
18
|
validatable = validatable_class.new
|
19
|
-
error_message = Helpers::Translator.error_message(validator,
|
19
|
+
error_message = Helpers::Translator.error_message(validator, :blank)
|
20
20
|
|
21
21
|
it_behaves_like "an invalid record",
|
22
22
|
validatable: validatable,
|
@@ -16,7 +16,7 @@ RSpec.shared_examples "a selection validator" do |validator, validatable_class,
|
|
16
16
|
context "when the #{attribute} is not valid" do
|
17
17
|
context "because the #{attribute} is not present" do
|
18
18
|
validatable = validatable_class.new
|
19
|
-
error_message = Helpers::Translator.error_message(validator,
|
19
|
+
error_message = Helpers::Translator.error_message(validator, :inclusion)
|
20
20
|
|
21
21
|
it_behaves_like "an invalid record",
|
22
22
|
validatable: validatable,
|
@@ -27,7 +27,7 @@ RSpec.shared_examples "a selection validator" do |validator, validatable_class,
|
|
27
27
|
|
28
28
|
context "because the #{attribute} is not from an approved list" do
|
29
29
|
validatable = validatable_class.new(values[:invalid])
|
30
|
-
error_message = Helpers::Translator.error_message(validator,
|
30
|
+
error_message = Helpers::Translator.error_message(validator, :inclusion)
|
31
31
|
|
32
32
|
it_behaves_like "an invalid record",
|
33
33
|
validatable: validatable,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: defra_ruby_validators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Defra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -318,34 +318,34 @@ signing_key:
|
|
318
318
|
specification_version: 4
|
319
319
|
summary: Defra ruby on rails validations
|
320
320
|
test_files:
|
321
|
-
- spec/
|
322
|
-
- spec/
|
321
|
+
- spec/cassettes/company_no_inactive.yml
|
322
|
+
- spec/cassettes/company_no_not_found.yml
|
323
|
+
- spec/cassettes/company_no_valid.yml
|
324
|
+
- spec/defra_ruby/validators/business_type_validator_spec.rb
|
325
|
+
- spec/defra_ruby/validators/companies_house_number_validator_spec.rb
|
323
326
|
- spec/defra_ruby/validators/companies_house_service_spec.rb
|
324
327
|
- spec/defra_ruby/validators/configuration_spec.rb
|
328
|
+
- spec/defra_ruby/validators/email_validator_spec.rb
|
329
|
+
- spec/defra_ruby/validators/grid_reference_validator_spec.rb
|
330
|
+
- spec/defra_ruby/validators/location_validator_spec.rb
|
325
331
|
- spec/defra_ruby/validators/phone_number_validator_spec.rb
|
326
332
|
- spec/defra_ruby/validators/position_validator_spec.rb
|
327
|
-
- spec/defra_ruby/validators/grid_reference_validator_spec.rb
|
328
|
-
- spec/defra_ruby/validators/business_type_validator_spec.rb
|
329
|
-
- spec/defra_ruby/validators/companies_house_number_validator_spec.rb
|
330
333
|
- spec/defra_ruby/validators/token_validator_spec.rb
|
331
334
|
- spec/defra_ruby/validators/true_false_validator_spec.rb
|
332
|
-
- spec/defra_ruby/
|
333
|
-
- spec/defra_ruby/validators/email_validator_spec.rb
|
335
|
+
- spec/defra_ruby/validators_spec.rb
|
334
336
|
- spec/examples.txt
|
335
|
-
- spec/
|
336
|
-
- spec/cassettes/company_no_valid.yml
|
337
|
-
- spec/cassettes/company_no_inactive.yml
|
338
|
-
- spec/support/simplecov.rb
|
339
|
-
- spec/support/i18n.rb
|
340
|
-
- spec/support/vcr.rb
|
341
|
-
- spec/support/pry.rb
|
337
|
+
- spec/spec_helper.rb
|
342
338
|
- spec/support/defra_ruby_validators.rb
|
343
|
-
- spec/support/helpers/translator.rb
|
344
339
|
- spec/support/helpers/text_generator.rb
|
345
|
-
- spec/support/
|
346
|
-
- spec/support/
|
347
|
-
- spec/support/
|
340
|
+
- spec/support/helpers/translator.rb
|
341
|
+
- spec/support/i18n.rb
|
342
|
+
- spec/support/pry.rb
|
348
343
|
- spec/support/shared_examples/validators/characters_validator.rb
|
344
|
+
- spec/support/shared_examples/validators/invalid_record.rb
|
349
345
|
- spec/support/shared_examples/validators/length_validator.rb
|
346
|
+
- spec/support/shared_examples/validators/presence_validator.rb
|
347
|
+
- spec/support/shared_examples/validators/selection_validator.rb
|
350
348
|
- spec/support/shared_examples/validators/valid_record.rb
|
351
349
|
- spec/support/shared_examples/validators/validator.rb
|
350
|
+
- spec/support/simplecov.rb
|
351
|
+
- spec/support/vcr.rb
|