hermod 1.2.1 → 1.2.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4d40bccb37c4c61cf02ab0bd89a8932a9f3ec0b
|
4
|
+
data.tar.gz: e885202d718924adf30ba38de5458eb8c744c54f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fbd5803537fbffb72181d76b02ee80dd331f42785dcacef522b029f066fc39f10a001c7dfe6c6f77c3f267993ae7d02230c43a10ddf2c6062df49d0dbe8dfac
|
7
|
+
data.tar.gz: 55e59b5baebf9c6dc598dd02343fd6dc48272b87803f4c5a5aee83e4a523a2b49518e4344a2093a75905d5e32488f5a343d89e051683564639def023e64461a6
|
@@ -13,8 +13,12 @@ module Hermod
|
|
13
13
|
|
14
14
|
private
|
15
15
|
|
16
|
+
# Public: Checks the value matches the pattern. Blank values are ignored
|
17
|
+
# because those are checked by the ValuePresence validator if necessary.
|
18
|
+
#
|
19
|
+
# Returns a boolean
|
16
20
|
def test
|
17
|
-
value =~ pattern
|
21
|
+
value.blank? || value =~ pattern
|
18
22
|
end
|
19
23
|
|
20
24
|
def message
|
data/lib/hermod/version.rb
CHANGED
@@ -11,6 +11,11 @@ module Hermod
|
|
11
11
|
subject.valid?("AB123456C", {}).must_equal true
|
12
12
|
end
|
13
13
|
|
14
|
+
it "allows blank values" do
|
15
|
+
subject.valid?("", {}).must_equal true
|
16
|
+
subject.valid?(nil, {}).must_equal true
|
17
|
+
end
|
18
|
+
|
14
19
|
it "raises an error for values that don't match the pattern" do
|
15
20
|
ex = proc { subject.valid?("fish", {}) }.must_raise InvalidInputError
|
16
21
|
ex.message.must_equal "\"fish\" does not match /\\A[A-Z]{2} [0-9]{6} [A-D]\\z/x"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hermod
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harry Mills
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: libxml-ruby
|
@@ -223,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
223
|
version: '0'
|
224
224
|
requirements: []
|
225
225
|
rubyforge_project:
|
226
|
-
rubygems_version: 2.
|
226
|
+
rubygems_version: 2.4.2
|
227
227
|
signing_key:
|
228
228
|
specification_version: 4
|
229
229
|
summary: A Ruby library for talking to the HMRC Government Gateway.
|