hermod 1.2.0 → 1.2.1
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/LICENSE +1 -1
- data/lib/hermod/version.rb +1 -1
- data/lib/hermod/xml_section_builder.rb +1 -1
- data/spec/hermod/xml_section_builder/monetary_node_spec.rb +6 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 334b1c65cc654daa9a2b7c5636651adccbc27825
|
4
|
+
data.tar.gz: a7bb880b3892f923c75fb46a47e32a23d144bb5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63501760f93dae3c804387dd853b98a0435fb54bbd2b5c236a9caee2b0e6d5dbbfbeb4fa22ab68e454a73a461cadb177b7aa088554969eefbcec2e310eb88930
|
7
|
+
data.tar.gz: 3db9d246c3e1e3223d7ec1c7e662972afe0b3d84f8b7b8faf580a4807def4e6ae9cf51cfe7dd6de767b522fa86b79fe972643afbf4599efc443260179539d552
|
data/LICENSE
CHANGED
@@ -187,7 +187,7 @@
|
|
187
187
|
same "printed page" as the copyright notice for easier
|
188
188
|
identification within third-party archives.
|
189
189
|
|
190
|
-
Copyright
|
190
|
+
Copyright 2014 FreeAgent Central
|
191
191
|
|
192
192
|
Licensed under the Apache License, Version 2.0 (the "License");
|
193
193
|
you may not use this file except in compliance with the License.
|
data/lib/hermod/version.rb
CHANGED
@@ -147,8 +147,8 @@ module Hermod
|
|
147
147
|
def monetary_node(name, options={})
|
148
148
|
validators = [].tap do |validators|
|
149
149
|
validators << Validators::NonNegative.new unless options.fetch(:negative, true)
|
150
|
+
validators << Validators::NonZero.new unless options.fetch(:zero, true)
|
150
151
|
validators << Validators::WholeUnits.new if options[:whole_units]
|
151
|
-
validators << Validators::NonZero.new unless options[:optional]
|
152
152
|
end
|
153
153
|
|
154
154
|
create_method(name, [], validators, options) do |value, attributes|
|
@@ -8,6 +8,7 @@ module Hermod
|
|
8
8
|
builder.monetary_node :tax, optional: true
|
9
9
|
builder.monetary_node :ni, xml_name: "NI", negative: false
|
10
10
|
builder.monetary_node :pension, whole_units: true
|
11
|
+
builder.monetary_node :student_loan, zero: false, negative: false
|
11
12
|
end
|
12
13
|
|
13
14
|
describe "Monetary nodes" do
|
@@ -45,6 +46,11 @@ module Hermod
|
|
45
46
|
ex = proc { subject.pension BigDecimal.new("12.34") }.must_raise InvalidInputError
|
46
47
|
ex.message.must_equal "pension must be in whole units"
|
47
48
|
end
|
49
|
+
|
50
|
+
it "should not allow zero for nodes that disallow it" do
|
51
|
+
ex = proc { subject.student_loan 0 }.must_raise Hermod::InvalidInputError
|
52
|
+
ex.message.must_equal "student_loan cannot be zero"
|
53
|
+
end
|
48
54
|
end
|
49
55
|
end
|
50
56
|
end
|
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.1
|
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
|
+
date: 2014-10-27 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.2.2
|
227
227
|
signing_key:
|
228
228
|
specification_version: 4
|
229
229
|
summary: A Ruby library for talking to the HMRC Government Gateway.
|