hermod 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cdd493e70d309b8dddb2c9ec72d3f7bbf3f1382d
4
- data.tar.gz: 15b69c23091b9323b477cf2a745469c02fd421ed
3
+ metadata.gz: 5f21de3838137e5e173db7659b44dce6d0aad5a1
4
+ data.tar.gz: 1ebc8f0abee7ece91ed6d33f0d5ada0625b340ec
5
5
  SHA512:
6
- metadata.gz: f2b8af05d20e045cca9b2319ddd33561f828535db9bed7696a8b85c3e87b9c7e7660d99bfc1ce7dc24957d80a245ae71ea8ddb01fb6e3d7dede3c957848195b3
7
- data.tar.gz: eef967388b2e6302cdcc177056a37582c65a298a82d5696255847d2326956778f97b811535b7255203aa0f5ce257708e3cf79660079bf4d40692e8fd275149a9
6
+ metadata.gz: f3b46d2f8bd2138ea5665937c363ab89ccb8770302ada2acca9f9b003469b834ef2ce6e9caf6dd7f243bc8bbfb95e8ad3bc83218246d3f4996046675e36df793
7
+ data.tar.gz: 82282f32439e82b57e2a0e0255e082b4b724ff47961511f11b58cc6e453e4fae6febc80189a73fa7d4c14f7b9b0bd9a8b59981b6a81491f70c7e2125276130bf
@@ -8,7 +8,7 @@ module Hermod
8
8
  private
9
9
 
10
10
  def test
11
- value >= 0
11
+ value.blank? || value >= 0
12
12
  end
13
13
 
14
14
  def message
@@ -8,7 +8,7 @@ module Hermod
8
8
  private
9
9
 
10
10
  def test
11
- value.to_i != 0
11
+ value.blank? || value.to_i != 0
12
12
  end
13
13
 
14
14
  def message
@@ -17,7 +17,7 @@ module Hermod
17
17
  private
18
18
 
19
19
  def test
20
- range.cover?(value)
20
+ value.blank? || range.cover?(value)
21
21
  end
22
22
 
23
23
  def message
@@ -9,7 +9,7 @@ module Hermod
9
9
  private
10
10
 
11
11
  def test
12
- value == value.to_i
12
+ value.blank? || value == value.to_i
13
13
  end
14
14
 
15
15
  def message
@@ -1,3 +1,3 @@
1
1
  module Hermod
2
- VERSION = "1.2.4"
2
+ VERSION = "1.2.5"
3
3
  end
@@ -15,6 +15,10 @@ module Hermod
15
15
  subject.valid?(0, {}).must_equal true
16
16
  end
17
17
 
18
+ it "allows blank values" do
19
+ subject.valid?(nil, {}).must_equal true
20
+ end
21
+
18
22
  it "raises an error for negative values" do
19
23
  ex = proc { subject.valid?(-1, {}) }.must_raise InvalidInputError
20
24
  ex.message.must_equal "cannot be negative"
@@ -15,6 +15,10 @@ module Hermod
15
15
  subject.valid?(-1, {}).must_equal true
16
16
  end
17
17
 
18
+ it "allows blank values" do
19
+ subject.valid?(nil, {}).must_equal true
20
+ end
21
+
18
22
  it "raises an error for zero values" do
19
23
  ex = proc { subject.valid?(0, {}) }.must_raise InvalidInputError
20
24
  ex.message.must_equal "cannot be zero"
@@ -12,6 +12,10 @@ module Hermod
12
12
  subject.valid?(7, {}).must_equal true
13
13
  end
14
14
 
15
+ it "allows blank values" do
16
+ subject.valid?(nil, {}).must_equal true
17
+ end
18
+
15
19
  it "raises an error for values outwith the range" do
16
20
  ex = proc { subject.valid?(0, {}) }.must_raise InvalidInputError
17
21
  ex.message.must_equal "must be between 1 and 7"
@@ -11,6 +11,10 @@ module Hermod
11
11
  subject.valid?(1.0, {}).must_equal true
12
12
  end
13
13
 
14
+ it "allows blank values" do
15
+ subject.valid?(nil, {}).must_equal true
16
+ end
17
+
14
18
  it "raises an error for values with a fractional componant" do
15
19
  ex = proc { subject.valid?(3.1415, {}) }.must_raise InvalidInputError
16
20
  ex.message.must_equal "must be in whole units"
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
4
+ version: 1.2.5
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-11-03 00:00:00.000000000 Z
11
+ date: 2014-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: libxml-ruby