rcap 2.5.0 → 2.5.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/CHANGELOG.md +4 -0
- data/lib/rcap/base/polygon.rb +2 -2
- data/lib/rcap/cap_1_2/polygon.rb +1 -1
- data/lib/rcap/custom_validators.rb +2 -1
- data/lib/rcap/version.rb +1 -1
- data/spec/cap_1_0/polygon_spec.rb +0 -5
- data/spec/cap_1_1/polygon_spec.rb +5 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e3471e557cf30f246f853bd2bd70f77b32e77da
|
4
|
+
data.tar.gz: 1a4cc77192840baef8e4f562ab87260b29ed251c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6135d4af1a059df7fce04ac0bb49206901d47aa1b2e5895811586d816bf40d673ab089addb02d775c6dd3922b516be6f9c34a13ca3da256eda2635e7b805bd5
|
7
|
+
data.tar.gz: 012295cee65d5c4c3d441ba4f332cf144645d0293e629ac6eac7e006a43a6fb93b2212501293a27a15bfd58c25101a28f4d2fe66d4dc68a140532d0a034a039c
|
data/CHANGELOG.md
CHANGED
data/lib/rcap/base/polygon.rb
CHANGED
@@ -7,8 +7,8 @@ module RCAP
|
|
7
7
|
attr_reader(:points)
|
8
8
|
|
9
9
|
validates_collection_of(:points)
|
10
|
-
validates_length_of(:points, minimum: 3)
|
11
|
-
validates_equality_of_first_and_last(:points)
|
10
|
+
validates_length_of(:points, minimum: 3, allow_blank: true)
|
11
|
+
validates_equality_of_first_and_last(:points, allow_empty: true)
|
12
12
|
|
13
13
|
XML_ELEMENT_NAME = 'polygon'
|
14
14
|
XPATH = "cap:#{ XML_ELEMENT_NAME }"
|
data/lib/rcap/cap_1_2/polygon.rb
CHANGED
@@ -4,7 +4,7 @@ module RCAP
|
|
4
4
|
# * it has a minimum of three points
|
5
5
|
# * each Point object in the points collection is valid
|
6
6
|
class Polygon < RCAP::Base::Polygon
|
7
|
-
validates_length_of(:points, minimum: 4)
|
7
|
+
validates_length_of(:points, minimum: 4, allow_blank: true)
|
8
8
|
|
9
9
|
# @return [Class]
|
10
10
|
def point_class
|
@@ -141,7 +141,8 @@ module Validation
|
|
141
141
|
}.merge!(attributes.extract_options!)
|
142
142
|
|
143
143
|
validates_each(*attributes) do |object, attribute, collection|
|
144
|
-
next if
|
144
|
+
next if collection.nil? && options[:allow_nil]
|
145
|
+
next if collection.empty? && options[:allow_empty]
|
145
146
|
unless collection.first == collection.last
|
146
147
|
object.errors[attribute] << options[:message]
|
147
148
|
end
|
data/lib/rcap/version.rb
CHANGED
@@ -14,11 +14,6 @@ describe(RCAP::CAP_1_0::Polygon) do
|
|
14
14
|
@polygon.should(be_valid)
|
15
15
|
end
|
16
16
|
|
17
|
-
it('does not have any points') do
|
18
|
-
@polygon.points.clear
|
19
|
-
@polygon.should_not(be_valid)
|
20
|
-
end
|
21
|
-
|
22
17
|
it('does not have a valid collection of points') do
|
23
18
|
@polygon.points.first.lattitude = nil
|
24
19
|
@polygon.should_not(be_valid)
|
@@ -10,18 +10,13 @@ describe(RCAP::CAP_1_1::Polygon) do
|
|
10
10
|
point.longitude = 0
|
11
11
|
end
|
12
12
|
end
|
13
|
-
@polygon.should(be_valid)
|
14
|
-
end
|
15
|
-
|
16
|
-
it('does not have any points') do
|
17
|
-
@polygon.points.clear
|
18
|
-
@polygon.should_not(be_valid)
|
19
13
|
end
|
14
|
+
@polygon.should(be_valid)
|
15
|
+
end
|
20
16
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
17
|
+
it('does not have a valid collection of points') do
|
18
|
+
@polygon.points.first.lattitude = nil
|
19
|
+
@polygon.should_not(be_valid)
|
25
20
|
end
|
26
21
|
end
|
27
22
|
|