defra_ruby_validators 2.4.1 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +9 -2
- data/lib/defra_ruby/validators/companies_house_number_validator.rb +7 -4
- data/lib/defra_ruby/validators/companies_house_service.rb +26 -12
- data/lib/defra_ruby/validators/version.rb +1 -1
- data/spec/defra_ruby/validators/companies_house_number_validator_spec.rb +16 -0
- data/spec/defra_ruby/validators/companies_house_service_spec.rb +31 -3
- data/spec/examples.txt +189 -0
- data/spec/support/i18n.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8964c61f339abf2c0d3a469cad34c7234caf819e1844f3968e04d85147cc67c4
|
4
|
+
data.tar.gz: bf2ad073d11e02f698039b03286c1519ff01126d384119b8f3c0785b2c1cf6cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f24569969b429ffd1c1d7db53c94420f47aa0b32538c0584403458ee4fdf45cb72a911341ef993c959a298a8256b94b3511867a54cb9fa098d04e4573547ee6a
|
7
|
+
data.tar.gz: 4b40e37219533ce6c295b33b00c267c45550855790832f37f363db07f63d83c8d2a04cbfd4a8bf6f1762f52639f56888b614d741b13712614ed02fe0113cbad0
|
data/README.md
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
# Defra Ruby Validators
|
2
2
|
|
3
|
-
|
3
|
+
![Build Status](https://github.com/DEFRA/defra-ruby-validators/workflows/CI/badge.svg?branch=main)
|
4
4
|
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=DEFRA_defra-ruby-validators&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=DEFRA_defra-ruby-validators)
|
5
5
|
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=DEFRA_defra-ruby-validators&metric=coverage)](https://sonarcloud.io/dashboard?id=DEFRA_defra-ruby-validators)
|
6
|
-
[![security](https://hakiri.io/github/DEFRA/defra-ruby-validators/main.svg)](https://hakiri.io/github/DEFRA/defra-ruby-validators/main)
|
7
6
|
[![Gem Version](https://badge.fury.io/rb/defra_ruby_validators.svg)](https://badge.fury.io/rb/defra_ruby_validators)
|
8
7
|
[![Licence](https://img.shields.io/badge/Licence-OGLv3-blue.svg)](http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3)
|
9
8
|
|
@@ -74,6 +73,14 @@ Add it to your model or form object using
|
|
74
73
|
validates :company_no, "defra_ruby/validators/companies_house_number": true
|
75
74
|
```
|
76
75
|
|
76
|
+
The company number also accepts a `company_type` option. This checks the `type` attribute in the API response. To validate that the company number is for a Limited Company, for example:
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
validates :company_no, "defra_ruby/validators/companies_house_number": { company_type: "ltd" }
|
80
|
+
```
|
81
|
+
|
82
|
+
Note: to mock the Companies House service with the `company_type` option, you will need to be running at least v2.2.0 of [defra-ruby-mocks](https://github.com/DEFRA/defra-ruby-mocks#companies-house).
|
83
|
+
|
77
84
|
### Email
|
78
85
|
|
79
86
|
This validator checks the value is present and in a format that meets [RFC 2822](https://tools.ietf.org/html/rfc2822) and [RFC 3696](https://tools.ietf.org/html/rfc3696) (we use [validates_email_format_of](https://github.com/validates-email-format-of/validates_email_format_of) to check the format).
|
@@ -17,7 +17,8 @@ module DefraRuby
|
|
17
17
|
return false unless value_is_present?(record, attribute, value)
|
18
18
|
return false unless format_is_valid?(record, attribute, value)
|
19
19
|
|
20
|
-
|
20
|
+
company_type = options[:company_type]
|
21
|
+
validate_with_companies_house(record, attribute, value, company_type)
|
21
22
|
end
|
22
23
|
|
23
24
|
private
|
@@ -36,19 +37,21 @@ module DefraRuby
|
|
36
37
|
false
|
37
38
|
end
|
38
39
|
|
39
|
-
def validate_with_companies_house(record, attribute, value)
|
40
|
-
case CompaniesHouseService.new(value).status
|
40
|
+
def validate_with_companies_house(record, attribute, value, company_type)
|
41
|
+
case CompaniesHouseService.new(value, company_type).status
|
41
42
|
when :active
|
42
43
|
true
|
43
44
|
when :inactive
|
44
45
|
add_validation_error(record, attribute, :inactive)
|
45
46
|
when :not_found
|
46
47
|
add_validation_error(record, attribute, :not_found)
|
48
|
+
else
|
49
|
+
# Sonarcloud suggested that not having an `else` is a code smell
|
50
|
+
add_validation_error(record, attribute, :error)
|
47
51
|
end
|
48
52
|
rescue StandardError
|
49
53
|
add_validation_error(record, attribute, :error)
|
50
54
|
end
|
51
|
-
|
52
55
|
end
|
53
56
|
end
|
54
57
|
end
|
@@ -5,31 +5,45 @@ require "rest-client"
|
|
5
5
|
module DefraRuby
|
6
6
|
module Validators
|
7
7
|
class CompaniesHouseService
|
8
|
-
def initialize(company_no)
|
8
|
+
def initialize(company_no, company_type = nil)
|
9
9
|
@company_no = company_no
|
10
10
|
@url = "#{DefraRuby::Validators.configuration.companies_house_host}#{@company_no}"
|
11
11
|
@api_key = DefraRuby::Validators.configuration.companies_house_api_key
|
12
|
+
@company_type = company_type
|
12
13
|
end
|
13
14
|
|
14
15
|
def status
|
15
|
-
|
16
|
-
method: :get,
|
17
|
-
url: @url,
|
18
|
-
user: @api_key,
|
19
|
-
password: ""
|
20
|
-
)
|
16
|
+
return :not_found unless company_type_is_allowed?(json_response)
|
21
17
|
|
22
|
-
|
23
|
-
|
24
|
-
status_is_allowed?(json["company_status"]) ? :active : :inactive
|
18
|
+
status_is_allowed?(json_response) ? :active : :inactive
|
25
19
|
rescue RestClient::ResourceNotFound
|
26
20
|
:not_found
|
27
21
|
end
|
28
22
|
|
23
|
+
def json_response
|
24
|
+
@_json_response ||=
|
25
|
+
JSON.parse(
|
26
|
+
RestClient::Request.execute(
|
27
|
+
method: :get,
|
28
|
+
url: @url,
|
29
|
+
user: @api_key,
|
30
|
+
password: ""
|
31
|
+
)
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
29
35
|
private
|
30
36
|
|
31
|
-
def status_is_allowed?(
|
32
|
-
%w[active voluntary-arrangement].include?(
|
37
|
+
def status_is_allowed?(json_response)
|
38
|
+
%w[active voluntary-arrangement].include?(json_response["company_status"])
|
39
|
+
end
|
40
|
+
|
41
|
+
def company_type_is_allowed?(json_response)
|
42
|
+
# if a company_type has not been defined in the validator,
|
43
|
+
# we skip this check
|
44
|
+
return true if @company_type.blank?
|
45
|
+
|
46
|
+
@company_type.to_s == json_response["type"]
|
33
47
|
end
|
34
48
|
end
|
35
49
|
end
|
@@ -8,6 +8,12 @@ module Test
|
|
8
8
|
|
9
9
|
validates :company_no, "defra_ruby/validators/companies_house_number": true
|
10
10
|
end
|
11
|
+
|
12
|
+
CompaniesHouseCompanyTypeAndNumberValidatable = Struct.new(:company_no) do
|
13
|
+
include ActiveModel::Validations
|
14
|
+
|
15
|
+
validates :company_no, "defra_ruby/validators/companies_house_number": { company_type: "ltd" }
|
16
|
+
end
|
11
17
|
end
|
12
18
|
|
13
19
|
module DefraRuby
|
@@ -86,6 +92,16 @@ module DefraRuby
|
|
86
92
|
error: :inactive,
|
87
93
|
error_message: error_message
|
88
94
|
end
|
95
|
+
|
96
|
+
context "with a company_type option" do
|
97
|
+
let(:company_no) { valid_numbers.first }
|
98
|
+
|
99
|
+
it "calls the companies house service with the `ltd` param" do
|
100
|
+
expect(CompaniesHouseService).to receive(:new).with(company_no, "ltd")
|
101
|
+
|
102
|
+
Test::CompaniesHouseCompanyTypeAndNumberValidatable.new(company_no).valid?
|
103
|
+
end
|
104
|
+
end
|
89
105
|
end
|
90
106
|
|
91
107
|
context "when there is an error connecting with companies house" do
|
@@ -3,13 +3,14 @@
|
|
3
3
|
require "webmock/rspec"
|
4
4
|
|
5
5
|
RSpec.describe DefraRuby::Validators::CompaniesHouseService do
|
6
|
-
let(:subject) { described_class.new("09360070") }
|
7
6
|
let(:host) { "https://api.companieshouse.gov.uk/" }
|
8
7
|
|
9
8
|
describe "#status" do
|
9
|
+
let(:subject) { described_class.new("09360070") }
|
10
|
+
|
10
11
|
context "when the company_no is for an active company" do
|
11
12
|
before do
|
12
|
-
expected_body = { "company_status": "active" }
|
13
|
+
expected_body = { "company_status": "active", "type": "ltd" }
|
13
14
|
|
14
15
|
stub_request(:any, /.*#{host}.*/).to_return(
|
15
16
|
status: 200,
|
@@ -36,7 +37,7 @@ RSpec.describe DefraRuby::Validators::CompaniesHouseService do
|
|
36
37
|
|
37
38
|
context "when the company_no is inactive" do
|
38
39
|
before do
|
39
|
-
expected_body = { "company_status": "dissolved" }
|
40
|
+
expected_body = { "company_status": "dissolved", "type": "ltd" }
|
40
41
|
|
41
42
|
stub_request(:any, /.*#{host}.*/).to_return(
|
42
43
|
status: 200,
|
@@ -49,6 +50,33 @@ RSpec.describe DefraRuby::Validators::CompaniesHouseService do
|
|
49
50
|
end
|
50
51
|
end
|
51
52
|
|
53
|
+
context "checking the company_type" do
|
54
|
+
let(:subject) { described_class.new("09360070", "llp") }
|
55
|
+
|
56
|
+
context "when the company_no is for a LLP" do
|
57
|
+
before do
|
58
|
+
stub_request(:any, /.*#{host}.*/).to_return(
|
59
|
+
status: 200,
|
60
|
+
body: expected_body.to_json
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
let(:expected_body) { { "company_status": "active", "type": "llp" } }
|
65
|
+
|
66
|
+
it "returns :active" do
|
67
|
+
expect(subject.status).to eq(:active)
|
68
|
+
end
|
69
|
+
|
70
|
+
context "but a ltd company is found" do
|
71
|
+
let(:expected_body) { { "company_status": "active", "type": "ltd" } }
|
72
|
+
|
73
|
+
it "returns :not_found" do
|
74
|
+
expect(subject.status).to eq(:not_found)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
52
80
|
context "when there is a problem with the Companies House API" do
|
53
81
|
context "and the request times out" do
|
54
82
|
before { stub_request(:any, /.*#{host}.*/).to_timeout }
|
data/spec/examples.txt
ADDED
@@ -0,0 +1,189 @@
|
|
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/support/i18n.rb
CHANGED
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.
|
4
|
+
version: 2.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Defra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -262,6 +262,7 @@ files:
|
|
262
262
|
- spec/defra_ruby/validators/token_validator_spec.rb
|
263
263
|
- spec/defra_ruby/validators/true_false_validator_spec.rb
|
264
264
|
- spec/defra_ruby/validators_spec.rb
|
265
|
+
- spec/examples.txt
|
265
266
|
- spec/spec_helper.rb
|
266
267
|
- spec/support/defra_ruby_validators.rb
|
267
268
|
- spec/support/helpers/text_generator.rb
|
@@ -296,8 +297,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
296
297
|
- !ruby/object:Gem::Version
|
297
298
|
version: '0'
|
298
299
|
requirements: []
|
299
|
-
|
300
|
-
rubygems_version: 2.6.13
|
300
|
+
rubygems_version: 3.1.2
|
301
301
|
signing_key:
|
302
302
|
specification_version: 4
|
303
303
|
summary: Defra ruby on rails validations
|
@@ -316,6 +316,7 @@ test_files:
|
|
316
316
|
- spec/defra_ruby/validators/true_false_validator_spec.rb
|
317
317
|
- spec/defra_ruby/validators/location_validator_spec.rb
|
318
318
|
- spec/defra_ruby/validators/email_validator_spec.rb
|
319
|
+
- spec/examples.txt
|
319
320
|
- spec/support/simplecov.rb
|
320
321
|
- spec/support/i18n.rb
|
321
322
|
- spec/support/pry.rb
|