rcap 2.5.0 → 2.5.1

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: 2b2493782c58861730c554776d6e5848e9b15728
4
- data.tar.gz: ab89552659a96fc8130ff839734c61a255403030
3
+ metadata.gz: 6e3471e557cf30f246f853bd2bd70f77b32e77da
4
+ data.tar.gz: 1a4cc77192840baef8e4f562ab87260b29ed251c
5
5
  SHA512:
6
- metadata.gz: c27d24fa3f957feb2f36ef8400d33a741c6e163ab79508a7c614f5dbaf7daf051bc81072132c04f985c31529fef475676165dddd4a386df5dc96b3e249e8cf00
7
- data.tar.gz: d220753d7b59abb718ce149ba7e25fe74e12bd7bf0b73b9b3f8e0170a801d0d476ba596ec66c879eb3d5051268e371c3d8ba6e97fa55b0ab6ce130fa1c9dc15d
6
+ metadata.gz: c6135d4af1a059df7fce04ac0bb49206901d47aa1b2e5895811586d816bf40d673ab089addb02d775c6dd3922b516be6f9c34a13ca3da256eda2635e7b805bd5
7
+ data.tar.gz: 012295cee65d5c4c3d441ba4f332cf144645d0293e629ac6eac7e006a43a6fb93b2212501293a27a15bfd58c25101a28f4d2fe66d4dc68a140532d0a034a039c
@@ -1,6 +1,10 @@
1
1
  Change Log
2
2
  ==========
3
3
 
4
+ ## 2.5.1 - 3 November 2014
5
+
6
+ * Allow the polygons to be empty.
7
+
4
8
  ## 2.5.0 - 3 November 2014
5
9
 
6
10
  * Allow the values of parameters, area codes and event codes to be empty.
@@ -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 }"
@@ -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 collection.nil? && options[:allow_nil]
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
@@ -1,3 +1,3 @@
1
1
  module RCAP
2
- VERSION = '2.5.0'
2
+ VERSION = '2.5.1'
3
3
  end
@@ -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
- it('does not have a valid collection of points') do
22
- @polygon.points.first.lattitude = nil
23
- @polygon.should_not(be_valid)
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rcap
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Farrel Lifson