rcap 2.4.1 → 2.7.3
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 +5 -5
 - data/.ruby-version +1 -0
 - data/CHANGELOG.md +18 -0
 - data/README.md +1 -0
 - data/lib/rcap.rb +3 -1
 - data/lib/rcap/alert.rb +30 -29
 - data/lib/rcap/base/alert.rb +208 -205
 - data/lib/rcap/base/area.rb +95 -91
 - data/lib/rcap/base/circle.rb +45 -34
 - data/lib/rcap/base/event_code.rb +2 -0
 - data/lib/rcap/base/geocode.rb +2 -0
 - data/lib/rcap/base/info.rb +273 -272
 - data/lib/rcap/base/parameter.rb +29 -28
 - data/lib/rcap/base/point.rb +26 -24
 - data/lib/rcap/base/polygon.rb +43 -35
 - data/lib/rcap/base/resource.rb +65 -65
 - data/lib/rcap/cap_1_0/alert.rb +85 -86
 - data/lib/rcap/cap_1_0/area.rb +2 -2
 - data/lib/rcap/cap_1_0/circle.rb +2 -1
 - data/lib/rcap/cap_1_0/event_code.rb +3 -1
 - data/lib/rcap/cap_1_0/geocode.rb +3 -1
 - data/lib/rcap/cap_1_0/info.rb +3 -3
 - data/lib/rcap/cap_1_0/parameter.rb +13 -13
 - data/lib/rcap/cap_1_0/point.rb +2 -1
 - data/lib/rcap/cap_1_0/polygon.rb +3 -3
 - data/lib/rcap/cap_1_0/resource.rb +2 -3
 - data/lib/rcap/cap_1_1/alert.rb +6 -6
 - data/lib/rcap/cap_1_1/area.rb +2 -2
 - data/lib/rcap/cap_1_1/circle.rb +2 -1
 - data/lib/rcap/cap_1_1/event_code.rb +3 -1
 - data/lib/rcap/cap_1_1/geocode.rb +3 -1
 - data/lib/rcap/cap_1_1/info.rb +125 -132
 - data/lib/rcap/cap_1_1/parameter.rb +2 -3
 - data/lib/rcap/cap_1_1/point.rb +2 -1
 - data/lib/rcap/cap_1_1/polygon.rb +3 -3
 - data/lib/rcap/cap_1_1/resource.rb +37 -38
 - data/lib/rcap/cap_1_2/alert.rb +6 -6
 - data/lib/rcap/cap_1_2/area.rb +2 -2
 - data/lib/rcap/cap_1_2/circle.rb +2 -1
 - data/lib/rcap/cap_1_2/event_code.rb +3 -1
 - data/lib/rcap/cap_1_2/geocode.rb +3 -1
 - data/lib/rcap/cap_1_2/info.rb +120 -123
 - data/lib/rcap/cap_1_2/parameter.rb +2 -3
 - data/lib/rcap/cap_1_2/point.rb +2 -1
 - data/lib/rcap/cap_1_2/polygon.rb +4 -4
 - data/lib/rcap/cap_1_2/resource.rb +38 -38
 - data/lib/rcap/config.rb +5 -3
 - data/lib/rcap/custom_validators.rb +75 -78
 - data/lib/rcap/extensions/array.rb +3 -1
 - data/lib/rcap/extensions/date.rb +3 -1
 - data/lib/rcap/extensions/date_time.rb +5 -2
 - data/lib/rcap/extensions/float.rb +2 -0
 - data/lib/rcap/extensions/integer.rb +7 -0
 - data/lib/rcap/extensions/nil_class.rb +2 -0
 - data/lib/rcap/extensions/string.rb +6 -4
 - data/lib/rcap/extensions/time.rb +5 -3
 - data/lib/rcap/formatters/yaml.rb +5 -0
 - data/lib/rcap/info.rb +6 -5
 - data/lib/rcap/utilities.rb +27 -30
 - data/lib/rcap/validation.rb +22 -21
 - data/lib/rcap/version.rb +3 -1
 - data/rcap.gemspec +5 -5
 - data/spec/alert_spec.rb +141 -141
 - data/spec/cap_1_0/alert_spec.rb +92 -94
 - data/spec/cap_1_0/area_spec.rb +86 -86
 - data/spec/cap_1_0/circle_spec.rb +48 -39
 - data/spec/cap_1_0/event_code_spec.rb +15 -15
 - data/spec/cap_1_0/geocode_spec.rb +16 -16
 - data/spec/cap_1_0/info_spec.rb +175 -177
 - data/spec/cap_1_0/parameter_spec.rb +27 -27
 - data/spec/cap_1_0/point_spec.rb +18 -18
 - data/spec/cap_1_0/polygon_spec.rb +43 -41
 - data/spec/cap_1_0/resource_spec.rb +63 -64
 - data/spec/cap_1_1/alert_spec.rb +107 -109
 - data/spec/cap_1_1/area_spec.rb +90 -90
 - data/spec/cap_1_1/circle_spec.rb +43 -34
 - data/spec/cap_1_1/event_code_spec.rb +15 -16
 - data/spec/cap_1_1/geocode_spec.rb +16 -16
 - data/spec/cap_1_1/info_spec.rb +194 -196
 - data/spec/cap_1_1/parameter_spec.rb +17 -17
 - data/spec/cap_1_1/point_spec.rb +18 -18
 - data/spec/cap_1_1/polygon_spec.rb +43 -41
 - data/spec/cap_1_1/resource_spec.rb +106 -107
 - data/spec/cap_1_2/alert_spec.rb +98 -99
 - data/spec/cap_1_2/area_spec.rb +90 -90
 - data/spec/cap_1_2/circle_spec.rb +52 -43
 - data/spec/cap_1_2/event_code_spec.rb +19 -20
 - data/spec/cap_1_2/geocode_spec.rb +20 -20
 - data/spec/cap_1_2/info_spec.rb +196 -198
 - data/spec/cap_1_2/parameter_spec.rb +19 -19
 - data/spec/cap_1_2/point_spec.rb +21 -21
 - data/spec/cap_1_2/polygon_spec.rb +55 -47
 - data/spec/cap_1_2/resource_spec.rb +96 -97
 - data/spec/extensions_spec.rb +29 -29
 - data/spec/info_spec.rb +15 -15
 - data/spec/spec_helper.rb +3 -3
 - data/spec/validations_spec.rb +73 -73
 - metadata +12 -11
 - data/lib/rcap/extensions/fixnum.rb +0 -5
 
    
        data/spec/cap_1_0/circle_spec.rb
    CHANGED
    
    | 
         @@ -1,45 +1,45 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            describe( 
     | 
| 
       4 
     | 
    
         
            -
              describe( 
     | 
| 
       5 
     | 
    
         
            -
                before( 
     | 
| 
      
 3 
     | 
    
         
            +
            describe(RCAP::CAP_1_0::Circle) do
         
     | 
| 
      
 4 
     | 
    
         
            +
              describe('should not be valid if') do
         
     | 
| 
      
 5 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
       6 
6 
     | 
    
         
             
                  @circle = RCAP::CAP_1_0::Circle.new do |circle|
         
     | 
| 
       7 
7 
     | 
    
         
             
                    circle.lattitude = 0
         
     | 
| 
       8 
8 
     | 
    
         
             
                    circle.longitude = 0
         
     | 
| 
       9 
9 
     | 
    
         
             
                    circle.radius = 1
         
     | 
| 
       10 
10 
     | 
    
         
             
                  end
         
     | 
| 
       11 
     | 
    
         
            -
                  @circle.should( 
     | 
| 
      
 11 
     | 
    
         
            +
                  @circle.should(be_valid)
         
     | 
| 
       12 
12 
     | 
    
         
             
                end
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
                it( 
     | 
| 
      
 14 
     | 
    
         
            +
                it('does not have a lattitude defined') do
         
     | 
| 
       15 
15 
     | 
    
         
             
                  @circle.lattitude = nil
         
     | 
| 
       16 
     | 
    
         
            -
                  @circle.should_not( 
     | 
| 
      
 16 
     | 
    
         
            +
                  @circle.should_not(be_valid)
         
     | 
| 
       17 
17 
     | 
    
         
             
                end
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
                it( 
     | 
| 
      
 19 
     | 
    
         
            +
                it('does not have a longitude defined') do
         
     | 
| 
       20 
20 
     | 
    
         
             
                  @circle.longitude = nil
         
     | 
| 
       21 
     | 
    
         
            -
                  @circle.should_not( 
     | 
| 
      
 21 
     | 
    
         
            +
                  @circle.should_not(be_valid)
         
     | 
| 
       22 
22 
     | 
    
         
             
                end
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
                it( 
     | 
| 
      
 24 
     | 
    
         
            +
                it('does not have a radius defined') do
         
     | 
| 
       25 
25 
     | 
    
         
             
                  @circle.radius = nil
         
     | 
| 
       26 
     | 
    
         
            -
                  @circle.should_not( 
     | 
| 
      
 26 
     | 
    
         
            +
                  @circle.should_not(be_valid)
         
     | 
| 
       27 
27 
     | 
    
         
             
                end
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
                it( 
     | 
| 
       30 
     | 
    
         
            -
                  @circle.radius =  
     | 
| 
       31 
     | 
    
         
            -
                  @circle.should_not( 
     | 
| 
      
 29 
     | 
    
         
            +
                it('does not have a numeric radius') do
         
     | 
| 
      
 30 
     | 
    
         
            +
                  @circle.radius = 'not a number'
         
     | 
| 
      
 31 
     | 
    
         
            +
                  @circle.should_not(be_valid)
         
     | 
| 
       32 
32 
     | 
    
         
             
                end
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
     | 
    
         
            -
                it( 
     | 
| 
      
 34 
     | 
    
         
            +
                it('does not have a positive radius') do
         
     | 
| 
       35 
35 
     | 
    
         
             
                  @circle.radius = -1
         
     | 
| 
       36 
     | 
    
         
            -
                  @circle.should_not( 
     | 
| 
      
 36 
     | 
    
         
            +
                  @circle.should_not(be_valid)
         
     | 
| 
       37 
37 
     | 
    
         
             
                end
         
     | 
| 
       38 
38 
     | 
    
         
             
              end
         
     | 
| 
       39 
39 
     | 
    
         | 
| 
       40 
     | 
    
         
            -
              context( 
     | 
| 
       41 
     | 
    
         
            -
                context( 
     | 
| 
       42 
     | 
    
         
            -
                  before( 
     | 
| 
      
 40 
     | 
    
         
            +
              context('on initialisation') do
         
     | 
| 
      
 41 
     | 
    
         
            +
                context('from XML') do
         
     | 
| 
      
 42 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
       43 
43 
     | 
    
         
             
                    @original_circle = RCAP::CAP_1_0::Circle.new do |circle|
         
     | 
| 
       44 
44 
     | 
    
         
             
                      circle.radius = 10.5
         
     | 
| 
       45 
45 
     | 
    
         
             
                      circle.lattitude = 30
         
     | 
| 
         @@ -52,46 +52,46 @@ describe( RCAP::CAP_1_0::Circle ) do 
     | 
|
| 
       52 
52 
     | 
    
         
             
                      circle.longitude = 60
         
     | 
| 
       53 
53 
     | 
    
         
             
                    end
         
     | 
| 
       54 
54 
     | 
    
         
             
                    @xml_string = @alert.to_xml
         
     | 
| 
       55 
     | 
    
         
            -
                    @xml_document = REXML::Document.new( 
     | 
| 
       56 
     | 
    
         
            -
                    @info_element = RCAP.xpath_first( 
     | 
| 
       57 
     | 
    
         
            -
                    @area_element = RCAP.xpath_first( 
     | 
| 
       58 
     | 
    
         
            -
                    @circle_element = RCAP.xpath_first( 
     | 
| 
       59 
     | 
    
         
            -
                    @circle = RCAP::CAP_1_0::Circle.from_xml_element( 
     | 
| 
      
 55 
     | 
    
         
            +
                    @xml_document = REXML::Document.new(@xml_string)
         
     | 
| 
      
 56 
     | 
    
         
            +
                    @info_element = RCAP.xpath_first(@xml_document.root, RCAP::CAP_1_0::Info::XPATH, RCAP::CAP_1_0::Alert::XMLNS)
         
     | 
| 
      
 57 
     | 
    
         
            +
                    @area_element = RCAP.xpath_first(@info_element, RCAP::CAP_1_0::Area::XPATH, RCAP::CAP_1_0::Alert::XMLNS)
         
     | 
| 
      
 58 
     | 
    
         
            +
                    @circle_element = RCAP.xpath_first(@area_element, RCAP::CAP_1_0::Circle::XPATH, RCAP::CAP_1_0::Alert::XMLNS)
         
     | 
| 
      
 59 
     | 
    
         
            +
                    @circle = RCAP::CAP_1_0::Circle.from_xml_element(@circle_element)
         
     | 
| 
       60 
60 
     | 
    
         
             
                  end
         
     | 
| 
       61 
61 
     | 
    
         | 
| 
       62 
     | 
    
         
            -
                  it( 
     | 
| 
      
 62 
     | 
    
         
            +
                  it('should parse the radius correctly') do
         
     | 
| 
       63 
63 
     | 
    
         
             
                    @circle.radius.should == @original_circle.radius
         
     | 
| 
       64 
64 
     | 
    
         
             
                  end
         
     | 
| 
       65 
65 
     | 
    
         | 
| 
       66 
     | 
    
         
            -
                  it( 
     | 
| 
      
 66 
     | 
    
         
            +
                  it('should parse the lattitude and longitude correctly') do
         
     | 
| 
       67 
67 
     | 
    
         
             
                    @circle.lattitude.should == @original_circle.lattitude
         
     | 
| 
       68 
68 
     | 
    
         
             
                    @circle.longitude.should == @original_circle.longitude
         
     | 
| 
       69 
69 
     | 
    
         
             
                  end
         
     | 
| 
       70 
70 
     | 
    
         
             
                end
         
     | 
| 
       71 
71 
     | 
    
         | 
| 
       72 
     | 
    
         
            -
                context( 
     | 
| 
       73 
     | 
    
         
            -
                  before( 
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
     | 
    
         
            -
                    @circle = RCAP::CAP_1_0::Circle.from_h( 
     | 
| 
      
 72 
     | 
    
         
            +
                context('from a hash') do
         
     | 
| 
      
 73 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
      
 74 
     | 
    
         
            +
                    @original_circle = RCAP::CAP_1_0::Circle.new do |circle|
         
     | 
| 
      
 75 
     | 
    
         
            +
                      circle.radius = 10.5
         
     | 
| 
      
 76 
     | 
    
         
            +
                      circle.lattitude = 30
         
     | 
| 
      
 77 
     | 
    
         
            +
                      circle.longitude = 60
         
     | 
| 
      
 78 
     | 
    
         
            +
                    end
         
     | 
| 
      
 79 
     | 
    
         
            +
                    @circle = RCAP::CAP_1_0::Circle.from_h(@original_circle.to_h)
         
     | 
| 
       80 
80 
     | 
    
         
             
                  end
         
     | 
| 
       81 
81 
     | 
    
         | 
| 
       82 
     | 
    
         
            -
                  it( 
     | 
| 
      
 82 
     | 
    
         
            +
                  it('should set the radius correctly') do
         
     | 
| 
       83 
83 
     | 
    
         
             
                    @circle.radius.should == @original_circle.radius
         
     | 
| 
       84 
84 
     | 
    
         
             
                  end
         
     | 
| 
       85 
85 
     | 
    
         | 
| 
       86 
     | 
    
         
            -
                  it( 
     | 
| 
      
 86 
     | 
    
         
            +
                  it('should parse the lattitude and longitude correctly') do
         
     | 
| 
       87 
87 
     | 
    
         
             
                    @circle.lattitude.should == @original_circle.lattitude
         
     | 
| 
       88 
88 
     | 
    
         
             
                    @circle.longitude.should == @original_circle.longitude
         
     | 
| 
       89 
89 
     | 
    
         
             
                  end
         
     | 
| 
       90 
90 
     | 
    
         
             
                end
         
     | 
| 
       91 
91 
     | 
    
         
             
              end
         
     | 
| 
       92 
92 
     | 
    
         | 
| 
       93 
     | 
    
         
            -
              context( 
     | 
| 
       94 
     | 
    
         
            -
                before( 
     | 
| 
      
 93 
     | 
    
         
            +
              context('when exported') do
         
     | 
| 
      
 94 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
       95 
95 
     | 
    
         
             
                  @circle = RCAP::CAP_1_0::Circle.new do |circle|
         
     | 
| 
       96 
96 
     | 
    
         
             
                    circle.radius = 10.5
         
     | 
| 
       97 
97 
     | 
    
         
             
                    circle.lattitude = 30
         
     | 
| 
         @@ -99,8 +99,17 @@ describe( RCAP::CAP_1_0::Circle ) do 
     | 
|
| 
       99 
99 
     | 
    
         
             
                  end
         
     | 
| 
       100 
100 
     | 
    
         
             
                end
         
     | 
| 
       101 
101 
     | 
    
         | 
| 
       102 
     | 
    
         
            -
                context( 
     | 
| 
       103 
     | 
    
         
            -
                  it( 
     | 
| 
      
 102 
     | 
    
         
            +
                context('to geojson') do
         
     | 
| 
      
 103 
     | 
    
         
            +
                  it('should be valid geojson') do
         
     | 
| 
      
 104 
     | 
    
         
            +
                    @circle.longitude = 5.6
         
     | 
| 
      
 105 
     | 
    
         
            +
                    expected = '{"type":"Feature","geometry":{"type":"Point",' \
         
     | 
| 
      
 106 
     | 
    
         
            +
                      '"coordinates":[5.6,30]},"properties":{"radius":10.5}}'
         
     | 
| 
      
 107 
     | 
    
         
            +
                    expect(@circle.to_geojson).to eq expected
         
     | 
| 
      
 108 
     | 
    
         
            +
                  end
         
     | 
| 
      
 109 
     | 
    
         
            +
                end
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
                context('to hash') do
         
     | 
| 
      
 112 
     | 
    
         
            +
                  it('should be correct') do
         
     | 
| 
       104 
113 
     | 
    
         
             
                    @circle.to_h.should == { 'radius' => 10.5, 'lattitude' => 30, 'longitude' => 60 }
         
     | 
| 
       105 
114 
     | 
    
         
             
                  end
         
     | 
| 
       106 
115 
     | 
    
         
             
                end
         
     | 
| 
         @@ -1,9 +1,9 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            describe( 
     | 
| 
       4 
     | 
    
         
            -
              context( 
     | 
| 
       5 
     | 
    
         
            -
                context( 
     | 
| 
       6 
     | 
    
         
            -
                  before( 
     | 
| 
      
 3 
     | 
    
         
            +
            describe(RCAP::CAP_1_0::EventCode) do
         
     | 
| 
      
 4 
     | 
    
         
            +
              context('when initialised') do
         
     | 
| 
      
 5 
     | 
    
         
            +
                context('from XML') do
         
     | 
| 
      
 6 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
       7 
7 
     | 
    
         
             
                    @original_event_code = RCAP::CAP_1_0::EventCode.new do |event_code|
         
     | 
| 
       8 
8 
     | 
    
         
             
                      event_code.name = 'name'
         
     | 
| 
       9 
9 
     | 
    
         
             
                      event_code.value = 'value'
         
     | 
| 
         @@ -11,36 +11,36 @@ describe( RCAP::CAP_1_0::EventCode ) do 
     | 
|
| 
       11 
11 
     | 
    
         
             
                    @alert = RCAP::CAP_1_0::Alert.new
         
     | 
| 
       12 
12 
     | 
    
         
             
                    @alert.add_info.event_codes <<  @original_event_code
         
     | 
| 
       13 
13 
     | 
    
         
             
                    @xml_string = @alert.to_xml
         
     | 
| 
       14 
     | 
    
         
            -
                    @xml_document = REXML::Document.new( 
     | 
| 
       15 
     | 
    
         
            -
                    @info_xml_element = RCAP.xpath_first( 
     | 
| 
       16 
     | 
    
         
            -
                    @event_code_xml_element = RCAP.xpath_first( 
     | 
| 
       17 
     | 
    
         
            -
                    @event_code = RCAP::CAP_1_0::EventCode.from_xml_element( 
     | 
| 
      
 14 
     | 
    
         
            +
                    @xml_document = REXML::Document.new(@xml_string)
         
     | 
| 
      
 15 
     | 
    
         
            +
                    @info_xml_element = RCAP.xpath_first(@xml_document.root, RCAP::CAP_1_0::Info::XPATH, RCAP::CAP_1_0::Alert::XMLNS)
         
     | 
| 
      
 16 
     | 
    
         
            +
                    @event_code_xml_element = RCAP.xpath_first(@info_xml_element, RCAP::CAP_1_0::EventCode::XPATH, RCAP::CAP_1_0::Alert::XMLNS)
         
     | 
| 
      
 17 
     | 
    
         
            +
                    @event_code = RCAP::CAP_1_0::EventCode.from_xml_element(@event_code_xml_element)
         
     | 
| 
       18 
18 
     | 
    
         
             
                  end
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
                  it( 
     | 
| 
      
 20 
     | 
    
         
            +
                  it('should parse into the correct class') do
         
     | 
| 
       21 
21 
     | 
    
         
             
                    @event_code.class.should == RCAP::CAP_1_0::EventCode
         
     | 
| 
       22 
22 
     | 
    
         
             
                  end
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
                  it( 
     | 
| 
      
 24 
     | 
    
         
            +
                  it('should parse the name correctly') do
         
     | 
| 
       25 
25 
     | 
    
         
             
                    @event_code.name.should == @original_event_code.name
         
     | 
| 
       26 
26 
     | 
    
         
             
                  end
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
     | 
    
         
            -
                  it( 
     | 
| 
      
 28 
     | 
    
         
            +
                  it('should parse the value correctly') do
         
     | 
| 
       29 
29 
     | 
    
         
             
                    @event_code.value.should == @original_event_code.value
         
     | 
| 
       30 
30 
     | 
    
         
             
                  end
         
     | 
| 
       31 
31 
     | 
    
         
             
                end
         
     | 
| 
       32 
32 
     | 
    
         
             
              end
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
     | 
    
         
            -
              context( 
     | 
| 
       35 
     | 
    
         
            -
                before( 
     | 
| 
      
 34 
     | 
    
         
            +
              context('when exported') do
         
     | 
| 
      
 35 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
       36 
36 
     | 
    
         
             
                  @event_code = RCAP::CAP_1_0::EventCode.new do |event_code|
         
     | 
| 
       37 
37 
     | 
    
         
             
                    event_code.name = 'name'
         
     | 
| 
       38 
38 
     | 
    
         
             
                    event_code.value = 'value'
         
     | 
| 
       39 
39 
     | 
    
         
             
                  end
         
     | 
| 
       40 
40 
     | 
    
         
             
                end
         
     | 
| 
       41 
41 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
                context( 
     | 
| 
       43 
     | 
    
         
            -
                  it( 
     | 
| 
      
 42 
     | 
    
         
            +
                context('to a hash') do
         
     | 
| 
      
 43 
     | 
    
         
            +
                  it('should export correctly') do
         
     | 
| 
       44 
44 
     | 
    
         
             
                    @event_code.to_h.should == { 'name' => 'value' }
         
     | 
| 
       45 
45 
     | 
    
         
             
                  end
         
     | 
| 
       46 
46 
     | 
    
         
             
                end
         
     | 
| 
         @@ -1,9 +1,9 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            describe( 
     | 
| 
       4 
     | 
    
         
            -
              context( 
     | 
| 
       5 
     | 
    
         
            -
                context( 
     | 
| 
       6 
     | 
    
         
            -
                  before( 
     | 
| 
      
 3 
     | 
    
         
            +
            describe(RCAP::CAP_1_0::Geocode) do
         
     | 
| 
      
 4 
     | 
    
         
            +
              context('when initialised') do
         
     | 
| 
      
 5 
     | 
    
         
            +
                context('from XML') do
         
     | 
| 
      
 6 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
       7 
7 
     | 
    
         
             
                    @original_geocode = RCAP::CAP_1_0::Geocode.new do |geocode|
         
     | 
| 
       8 
8 
     | 
    
         
             
                      geocode.name = 'name'
         
     | 
| 
       9 
9 
     | 
    
         
             
                      geocode.value = 'value'
         
     | 
| 
         @@ -11,37 +11,37 @@ describe( RCAP::CAP_1_0::Geocode ) do 
     | 
|
| 
       11 
11 
     | 
    
         
             
                    @alert = RCAP::CAP_1_0::Alert.new
         
     | 
| 
       12 
12 
     | 
    
         
             
                    @alert.add_info.add_area.geocodes <<  @original_geocode
         
     | 
| 
       13 
13 
     | 
    
         
             
                    @xml_string = @alert.to_xml
         
     | 
| 
       14 
     | 
    
         
            -
                    @xml_document = REXML::Document.new( 
     | 
| 
       15 
     | 
    
         
            -
                    @info_xml_element = RCAP.xpath_first( 
     | 
| 
       16 
     | 
    
         
            -
                    @area_xml_element = RCAP.xpath_first( 
     | 
| 
       17 
     | 
    
         
            -
                    @geocode_xml_element = RCAP.xpath_first( 
     | 
| 
       18 
     | 
    
         
            -
                    @geocode = RCAP::CAP_1_0::Geocode.from_xml_element( 
     | 
| 
      
 14 
     | 
    
         
            +
                    @xml_document = REXML::Document.new(@xml_string)
         
     | 
| 
      
 15 
     | 
    
         
            +
                    @info_xml_element = RCAP.xpath_first(@xml_document.root, RCAP::CAP_1_0::Info::XPATH, RCAP::CAP_1_0::Alert::XMLNS)
         
     | 
| 
      
 16 
     | 
    
         
            +
                    @area_xml_element = RCAP.xpath_first(@info_xml_element, RCAP::CAP_1_0::Area::XPATH, RCAP::CAP_1_0::Alert::XMLNS)
         
     | 
| 
      
 17 
     | 
    
         
            +
                    @geocode_xml_element = RCAP.xpath_first(@area_xml_element, RCAP::CAP_1_0::Geocode::XPATH, RCAP::CAP_1_0::Alert::XMLNS)
         
     | 
| 
      
 18 
     | 
    
         
            +
                    @geocode = RCAP::CAP_1_0::Geocode.from_xml_element(@geocode_xml_element)
         
     | 
| 
       19 
19 
     | 
    
         
             
                  end
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
                  it( 
     | 
| 
      
 21 
     | 
    
         
            +
                  it('should parse into the correct class') do
         
     | 
| 
       22 
22 
     | 
    
         
             
                    @geocode.class.should == RCAP::CAP_1_0::Geocode
         
     | 
| 
       23 
23 
     | 
    
         
             
                  end
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
                  it( 
     | 
| 
      
 25 
     | 
    
         
            +
                  it('should parse the name correctly') do
         
     | 
| 
       26 
26 
     | 
    
         
             
                    @geocode.name.should == @original_geocode.name
         
     | 
| 
       27 
27 
     | 
    
         
             
                  end
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
                  it( 
     | 
| 
      
 29 
     | 
    
         
            +
                  it('should parse the value correctly') do
         
     | 
| 
       30 
30 
     | 
    
         
             
                    @geocode.value.should == @original_geocode.value
         
     | 
| 
       31 
31 
     | 
    
         
             
                  end
         
     | 
| 
       32 
32 
     | 
    
         
             
                end
         
     | 
| 
       33 
33 
     | 
    
         
             
              end
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
     | 
    
         
            -
              context( 
     | 
| 
       36 
     | 
    
         
            -
                before( 
     | 
| 
      
 35 
     | 
    
         
            +
              context('when exported') do
         
     | 
| 
      
 36 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
       37 
37 
     | 
    
         
             
                  @geocode = RCAP::CAP_1_0::Geocode.new do |geocode|
         
     | 
| 
       38 
38 
     | 
    
         
             
                    geocode.name = 'name'
         
     | 
| 
       39 
39 
     | 
    
         
             
                    geocode.value = 'value'
         
     | 
| 
       40 
40 
     | 
    
         
             
                  end
         
     | 
| 
       41 
41 
     | 
    
         
             
                end
         
     | 
| 
       42 
42 
     | 
    
         | 
| 
       43 
     | 
    
         
            -
                context( 
     | 
| 
       44 
     | 
    
         
            -
                  it( 
     | 
| 
      
 43 
     | 
    
         
            +
                context('to a hash') do
         
     | 
| 
      
 44 
     | 
    
         
            +
                  it('should export correctly') do
         
     | 
| 
       45 
45 
     | 
    
         
             
                    @geocode.to_h.should == { 'name' => 'value' }
         
     | 
| 
       46 
46 
     | 
    
         
             
                  end
         
     | 
| 
       47 
47 
     | 
    
         
             
                end
         
     | 
    
        data/spec/cap_1_0/info_spec.rb
    CHANGED
    
    | 
         @@ -1,123 +1,122 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            describe( 
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe(RCAP::CAP_1_0::Info) do
         
     | 
| 
      
 4 
     | 
    
         
            +
              def create_info
         
     | 
| 
      
 5 
     | 
    
         
            +
                RCAP::CAP_1_0::Info.new do |info|
         
     | 
| 
      
 6 
     | 
    
         
            +
                  [RCAP::CAP_1_0::Info::CATEGORY_GEO, RCAP::CAP_1_0::Info::CATEGORY_FIRE].each do |category|
         
     | 
| 
      
 7 
     | 
    
         
            +
                    info.categories << category
         
     | 
| 
      
 8 
     | 
    
         
            +
                  end
         
     | 
| 
      
 9 
     | 
    
         
            +
                  info.event       = 'Event Description'
         
     | 
| 
      
 10 
     | 
    
         
            +
                  info.urgency     = RCAP::CAP_1_0::Info::URGENCY_IMMEDIATE
         
     | 
| 
      
 11 
     | 
    
         
            +
                  info.severity    = RCAP::CAP_1_0::Info::SEVERITY_EXTREME
         
     | 
| 
      
 12 
     | 
    
         
            +
                  info.certainty   = RCAP::CAP_1_0::Info::CERTAINTY_VERY_LIKELY
         
     | 
| 
      
 13 
     | 
    
         
            +
                  info.audience    = 'Audience'
         
     | 
| 
      
 14 
     | 
    
         
            +
                  info.effective   = DateTime.now
         
     | 
| 
      
 15 
     | 
    
         
            +
                  info.onset       = DateTime.now + 1
         
     | 
| 
      
 16 
     | 
    
         
            +
                  info.expires     = DateTime.now + 2
         
     | 
| 
      
 17 
     | 
    
         
            +
                  info.sender_name = 'Sender Name'
         
     | 
| 
      
 18 
     | 
    
         
            +
                  info.headline    = 'Headline'
         
     | 
| 
      
 19 
     | 
    
         
            +
                  info.description = 'Description'
         
     | 
| 
      
 20 
     | 
    
         
            +
                  info.instruction = 'Instruction'
         
     | 
| 
      
 21 
     | 
    
         
            +
                  info.web         = 'http://website'
         
     | 
| 
      
 22 
     | 
    
         
            +
                  info.contact     = 'contact@address'
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                  info.add_resource do |resource|
         
     | 
| 
      
 25 
     | 
    
         
            +
                    resource.resource_desc = 'Resource Description'
         
     | 
| 
      
 26 
     | 
    
         
            +
                    resource.uri = 'http://tempuri.org/resource'
         
     | 
| 
      
 27 
     | 
    
         
            +
                  end
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
                      end
         
     | 
| 
      
 29 
     | 
    
         
            +
                  [%w(name1 value1), %w(name2 value2)].each do |name, value|
         
     | 
| 
      
 30 
     | 
    
         
            +
                    info.add_event_code do |event_code|
         
     | 
| 
      
 31 
     | 
    
         
            +
                      event_code.name = name
         
     | 
| 
      
 32 
     | 
    
         
            +
                      event_code.value = value
         
     | 
| 
       34 
33 
     | 
    
         
             
                    end
         
     | 
| 
      
 34 
     | 
    
         
            +
                  end
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
                      end
         
     | 
| 
      
 36 
     | 
    
         
            +
                  [%w(name1 value1), %w(name2 value2)].each do |name, value|
         
     | 
| 
      
 37 
     | 
    
         
            +
                    info.add_parameter do |parameter|
         
     | 
| 
      
 38 
     | 
    
         
            +
                      parameter.name = name
         
     | 
| 
      
 39 
     | 
    
         
            +
                      parameter.value = value
         
     | 
| 
       41 
40 
     | 
    
         
             
                    end
         
     | 
| 
      
 41 
     | 
    
         
            +
                  end
         
     | 
| 
       42 
42 
     | 
    
         | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                      end
         
     | 
| 
      
 43 
     | 
    
         
            +
                  %w(Area1 Area2).each do |area_desc|
         
     | 
| 
      
 44 
     | 
    
         
            +
                    info.add_area do |area|
         
     | 
| 
      
 45 
     | 
    
         
            +
                      area.area_desc = area_desc
         
     | 
| 
       47 
46 
     | 
    
         
             
                    end
         
     | 
| 
       48 
47 
     | 
    
         
             
                  end
         
     | 
| 
       49 
48 
     | 
    
         
             
                end
         
     | 
| 
       50 
     | 
    
         
            -
               
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
      
 49 
     | 
    
         
            +
              end
         
     | 
| 
      
 50 
     | 
    
         
            +
              context('on initialisation') do
         
     | 
| 
      
 51 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
       52 
52 
     | 
    
         
             
                  @info = RCAP::CAP_1_0::Info.new
         
     | 
| 
       53 
53 
     | 
    
         
             
                end
         
     | 
| 
       54 
54 
     | 
    
         | 
| 
       55 
     | 
    
         
            -
                it( 
     | 
| 
       56 
     | 
    
         
            -
                it( 
     | 
| 
       57 
     | 
    
         
            -
                it( 
     | 
| 
       58 
     | 
    
         
            -
                it( 
     | 
| 
       59 
     | 
    
         
            -
                it( 
     | 
| 
       60 
     | 
    
         
            -
                it( 
     | 
| 
       61 
     | 
    
         
            -
                it( 
     | 
| 
       62 
     | 
    
         
            -
                it( 
     | 
| 
       63 
     | 
    
         
            -
                it( 
     | 
| 
       64 
     | 
    
         
            -
                it( 
     | 
| 
       65 
     | 
    
         
            -
                it( 
     | 
| 
       66 
     | 
    
         
            -
                it( 
     | 
| 
       67 
     | 
    
         
            -
                it( 
     | 
| 
       68 
     | 
    
         
            -
                it( 
     | 
| 
       69 
     | 
    
         
            -
                it( 
     | 
| 
       70 
     | 
    
         
            -
                it( 
     | 
| 
       71 
     | 
    
         
            -
                it( 
     | 
| 
       72 
     | 
    
         
            -
                it( 
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
                shared_examples_for( 
     | 
| 
       75 
     | 
    
         
            -
                  it( 
     | 
| 
       76 
     | 
    
         
            -
                  it( 
     | 
| 
       77 
     | 
    
         
            -
                  it( 
     | 
| 
       78 
     | 
    
         
            -
                  it( 
     | 
| 
       79 
     | 
    
         
            -
                  it( 
     | 
| 
       80 
     | 
    
         
            -
                  it( 
     | 
| 
       81 
     | 
    
         
            -
                  it( 
     | 
| 
       82 
     | 
    
         
            -
                  it( 
     | 
| 
       83 
     | 
    
         
            -
                  it( 
     | 
| 
       84 
     | 
    
         
            -
                  it( 
     | 
| 
       85 
     | 
    
         
            -
                  it( 
     | 
| 
       86 
     | 
    
         
            -
                  it( 
     | 
| 
       87 
     | 
    
         
            -
                  it( 
     | 
| 
       88 
     | 
    
         
            -
                  it( 
     | 
| 
       89 
     | 
    
         
            -
                  it( 
     | 
| 
       90 
     | 
    
         
            -
                  it( 
     | 
| 
       91 
     | 
    
         
            -
                  it( 
     | 
| 
       92 
     | 
    
         
            -
                  it( 
     | 
| 
       93 
     | 
    
         
            -
                  it( 
     | 
| 
      
 55 
     | 
    
         
            +
                it('should have a default language of en-US') { @info.language.should == 'en-US' }
         
     | 
| 
      
 56 
     | 
    
         
            +
                it('should have no categories')               { @info.categories.should(be_empty) }
         
     | 
| 
      
 57 
     | 
    
         
            +
                it('should have no event')                    { @info.event.should(be_nil) }
         
     | 
| 
      
 58 
     | 
    
         
            +
                it('should have no urgency')                  { @info.urgency.should(be_nil) }
         
     | 
| 
      
 59 
     | 
    
         
            +
                it('should have no severity')                 { @info.severity.should(be_nil) }
         
     | 
| 
      
 60 
     | 
    
         
            +
                it('should have no certainty')                { @info.certainty.should(be_nil) }
         
     | 
| 
      
 61 
     | 
    
         
            +
                it('should have no audience')                 { @info.audience.should(be_nil) }
         
     | 
| 
      
 62 
     | 
    
         
            +
                it('should have no event_codes')              { @info.event_codes.should(be_empty) }
         
     | 
| 
      
 63 
     | 
    
         
            +
                it('should have no effective datetime')       { @info.effective.should(be_nil) }
         
     | 
| 
      
 64 
     | 
    
         
            +
                it('should have no onset datetime')           { @info.onset.should(be_nil) }
         
     | 
| 
      
 65 
     | 
    
         
            +
                it('should have no expires datetime')         { @info.expires.should(be_nil) }
         
     | 
| 
      
 66 
     | 
    
         
            +
                it('should have no sender name ')             { @info.sender_name.should(be_nil) }
         
     | 
| 
      
 67 
     | 
    
         
            +
                it('should have no headline')                 { @info.headline.should(be_nil) }
         
     | 
| 
      
 68 
     | 
    
         
            +
                it('should have no description')              { @info.description.should(be_nil) }
         
     | 
| 
      
 69 
     | 
    
         
            +
                it('should have no instruction')              { @info.instruction.should(be_nil) }
         
     | 
| 
      
 70 
     | 
    
         
            +
                it('should have no web')                      { @info.web.should(be_nil) }
         
     | 
| 
      
 71 
     | 
    
         
            +
                it('should have no contact')                  { @info.contact.should(be_nil) }
         
     | 
| 
      
 72 
     | 
    
         
            +
                it('should have no parameters')               { @info.parameters.should(be_empty) }
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
                shared_examples_for('it can parse into a CAP 1.0 Info object') do
         
     | 
| 
      
 75 
     | 
    
         
            +
                  it('should parse categories correctly') {     @info.categories.should_not(be_nil); @info.categories.should     ==    @original_info.categories }
         
     | 
| 
      
 76 
     | 
    
         
            +
                  it('should parse event correctly') {          @info.event.should_not(be_nil); @info.event.should          ==    @original_info.event }
         
     | 
| 
      
 77 
     | 
    
         
            +
                  it('should parse urgency correctly') {        @info.urgency.should_not(be_nil); @info.urgency.should        ==    @original_info.urgency }
         
     | 
| 
      
 78 
     | 
    
         
            +
                  it('should parse severity correctly') {       @info.severity.should_not(be_nil); @info.severity.should       ==    @original_info.severity }
         
     | 
| 
      
 79 
     | 
    
         
            +
                  it('should parse certainty correctly') {      @info.certainty.should_not(be_nil); @info.certainty.should      ==    @original_info.certainty }
         
     | 
| 
      
 80 
     | 
    
         
            +
                  it('should parse audience correctly') {       @info.audience.should_not(be_nil); @info.audience.should       ==    @original_info.audience }
         
     | 
| 
      
 81 
     | 
    
         
            +
                  it('should parse effective correctly') {      @info.effective.should_not(be_nil); @info.effective.should(be_within(Rational(1, 86_400)).of(@original_info.effective)) }
         
     | 
| 
      
 82 
     | 
    
         
            +
                  it('should parse onset correctly') {          @info.onset.should_not(be_nil); @info.onset.should(be_within(Rational(1, 86_400)).of(@original_info.onset)) }
         
     | 
| 
      
 83 
     | 
    
         
            +
                  it('should parse expires correctly') {        @info.expires.should_not(be_nil); @info.expires.should(be_within(Rational(1, 86_400)).of(@original_info.expires)) }
         
     | 
| 
      
 84 
     | 
    
         
            +
                  it('should parse sender_name correctly') {    @info.sender_name.should_not(be_nil); @info.sender_name.should    ==    @original_info.sender_name }
         
     | 
| 
      
 85 
     | 
    
         
            +
                  it('should parse headline correctly') {       @info.headline.should_not(be_nil); @info.headline.should       ==    @original_info.headline }
         
     | 
| 
      
 86 
     | 
    
         
            +
                  it('should parse description correctly') {    @info.description.should_not(be_nil); @info.description.should    ==    @original_info.description }
         
     | 
| 
      
 87 
     | 
    
         
            +
                  it('should parse instruction correctly') {    @info.instruction.should_not(be_nil); @info.instruction.should    ==    @original_info.instruction }
         
     | 
| 
      
 88 
     | 
    
         
            +
                  it('should parse web correctly') {            @info.web.should_not(be_nil); @info.web.should            ==    @original_info.web }
         
     | 
| 
      
 89 
     | 
    
         
            +
                  it('should parse contact correctly') {        @info.contact.should_not(be_nil); @info.contact.should        ==    @original_info.contact }
         
     | 
| 
      
 90 
     | 
    
         
            +
                  it('should parse event_codes correctly') {    @info.event_codes.should_not(be_nil); @info.event_codes.should    ==    @original_info.event_codes }
         
     | 
| 
      
 91 
     | 
    
         
            +
                  it('should parse parameters correctly') {     @info.parameters.should_not(be_nil); @info.parameters.should     ==    @original_info.parameters }
         
     | 
| 
      
 92 
     | 
    
         
            +
                  it('should parse resources correctly') {      @info.resources.should_not(be_nil); @info.resources.map(&:to_s).should      ==    @original_info.resources.map(&:to_s) }
         
     | 
| 
      
 93 
     | 
    
         
            +
                  it('should parse areas correctly') {          @info.areas.should_not(be_nil); @info.areas.should          ==    @original_info.areas }
         
     | 
| 
       94 
94 
     | 
    
         
             
                end
         
     | 
| 
       95 
95 
     | 
    
         | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
       98 
     | 
    
         
            -
                  before( :each ) do
         
     | 
| 
      
 96 
     | 
    
         
            +
                context('from XML') do
         
     | 
| 
      
 97 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
       99 
98 
     | 
    
         
             
                    @original_info = create_info
         
     | 
| 
       100 
99 
     | 
    
         
             
                    @alert = RCAP::CAP_1_0::Alert.new
         
     | 
| 
       101 
100 
     | 
    
         
             
                    @alert.infos << @original_info
         
     | 
| 
       102 
101 
     | 
    
         
             
                    @xml_string = @alert.to_xml
         
     | 
| 
       103 
     | 
    
         
            -
                    @xml_document = REXML::Document.new( 
     | 
| 
       104 
     | 
    
         
            -
                    @info = RCAP::CAP_1_0::Info.from_xml_element( 
     | 
| 
      
 102 
     | 
    
         
            +
                    @xml_document = REXML::Document.new(@xml_string)
         
     | 
| 
      
 103 
     | 
    
         
            +
                    @info = RCAP::CAP_1_0::Info.from_xml_element(RCAP.xpath_first(@xml_document.root, RCAP::CAP_1_0::Info::XPATH, RCAP::CAP_1_0::Alert::XMLNS))
         
     | 
| 
       105 
104 
     | 
    
         
             
                  end
         
     | 
| 
       106 
105 
     | 
    
         | 
| 
       107 
     | 
    
         
            -
                  it_should_behave_like( 
     | 
| 
      
 106 
     | 
    
         
            +
                  it_should_behave_like('it can parse into a CAP 1.0 Info object')
         
     | 
| 
       108 
107 
     | 
    
         
             
                end
         
     | 
| 
       109 
108 
     | 
    
         | 
| 
       110 
     | 
    
         
            -
                context( 
     | 
| 
       111 
     | 
    
         
            -
                  before( 
     | 
| 
      
 109 
     | 
    
         
            +
                context('from a hash') do
         
     | 
| 
      
 110 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
       112 
111 
     | 
    
         
             
                    @original_info = create_info
         
     | 
| 
       113 
     | 
    
         
            -
                    @info = RCAP::CAP_1_0::Info.from_h( 
     | 
| 
      
 112 
     | 
    
         
            +
                    @info = RCAP::CAP_1_0::Info.from_h(@original_info.to_h)
         
     | 
| 
       114 
113 
     | 
    
         
             
                  end
         
     | 
| 
       115 
     | 
    
         
            -
                  it_should_behave_like( 
     | 
| 
      
 114 
     | 
    
         
            +
                  it_should_behave_like('it can parse into a CAP 1.0 Info object')
         
     | 
| 
       116 
115 
     | 
    
         
             
                end
         
     | 
| 
       117 
116 
     | 
    
         
             
              end
         
     | 
| 
       118 
117 
     | 
    
         | 
| 
       119 
     | 
    
         
            -
              context( 
     | 
| 
       120 
     | 
    
         
            -
                before( 
     | 
| 
      
 118 
     | 
    
         
            +
              context('is not valid if it') do
         
     | 
| 
      
 119 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
       121 
120 
     | 
    
         
             
                  @info = RCAP::CAP_1_0::Info.new do |info|
         
     | 
| 
       122 
121 
     | 
    
         
             
                    info.event = 'Info Event'
         
     | 
| 
       123 
122 
     | 
    
         
             
                    info.categories <<  RCAP::CAP_1_0::Info::CATEGORY_GEO
         
     | 
| 
         @@ -127,193 +126,192 @@ describe( RCAP::CAP_1_0::Info ) do 
     | 
|
| 
       127 
126 
     | 
    
         
             
                  end
         
     | 
| 
       128 
127 
     | 
    
         
             
                  @info.valid?
         
     | 
| 
       129 
128 
     | 
    
         
             
                  puts @info.errors.full_messages
         
     | 
| 
       130 
     | 
    
         
            -
                  @info.should( 
     | 
| 
      
 129 
     | 
    
         
            +
                  @info.should(be_valid)
         
     | 
| 
       131 
130 
     | 
    
         
             
                end
         
     | 
| 
       132 
131 
     | 
    
         | 
| 
       133 
     | 
    
         
            -
                it( 
     | 
| 
      
 132 
     | 
    
         
            +
                it('does not have an event') do
         
     | 
| 
       134 
133 
     | 
    
         
             
                  @info.event = nil
         
     | 
| 
       135 
     | 
    
         
            -
                  @info.should_not( 
     | 
| 
      
 134 
     | 
    
         
            +
                  @info.should_not(be_valid)
         
     | 
| 
       136 
135 
     | 
    
         
             
                end
         
     | 
| 
       137 
136 
     | 
    
         | 
| 
       138 
     | 
    
         
            -
                it( 
     | 
| 
      
 137 
     | 
    
         
            +
                it('does not have an urgency') do
         
     | 
| 
       139 
138 
     | 
    
         
             
                  @info.urgency = nil
         
     | 
| 
       140 
     | 
    
         
            -
                  @info.should_not( 
     | 
| 
      
 139 
     | 
    
         
            +
                  @info.should_not(be_valid)
         
     | 
| 
       141 
140 
     | 
    
         
             
                end
         
     | 
| 
       142 
141 
     | 
    
         | 
| 
       143 
     | 
    
         
            -
                it( 
     | 
| 
      
 142 
     | 
    
         
            +
                it('does not have an severity') do
         
     | 
| 
       144 
143 
     | 
    
         
             
                  @info.severity = nil
         
     | 
| 
       145 
     | 
    
         
            -
                  @info.should_not( 
     | 
| 
      
 144 
     | 
    
         
            +
                  @info.should_not(be_valid)
         
     | 
| 
       146 
145 
     | 
    
         
             
                end
         
     | 
| 
       147 
146 
     | 
    
         | 
| 
       148 
     | 
    
         
            -
                it( 
     | 
| 
      
 147 
     | 
    
         
            +
                it('does not have an certainty') do
         
     | 
| 
       149 
148 
     | 
    
         
             
                  @info.certainty = nil
         
     | 
| 
       150 
     | 
    
         
            -
                  @info.should_not( 
     | 
| 
      
 149 
     | 
    
         
            +
                  @info.should_not(be_valid)
         
     | 
| 
       151 
150 
     | 
    
         
             
                end
         
     | 
| 
       152 
151 
     | 
    
         
             
              end
         
     | 
| 
       153 
152 
     | 
    
         | 
| 
       154 
     | 
    
         
            -
             
     | 
| 
       155 
     | 
    
         
            -
             
     | 
| 
       156 
     | 
    
         
            -
             
     | 
| 
       157 
     | 
    
         
            -
                  before( :each ) do
         
     | 
| 
      
 153 
     | 
    
         
            +
              describe('when exported') do
         
     | 
| 
      
 154 
     | 
    
         
            +
                context('to hash') do
         
     | 
| 
      
 155 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
       158 
156 
     | 
    
         
             
                    @info = create_info
         
     | 
| 
       159 
157 
     | 
    
         
             
                    @info_hash = @info.to_h
         
     | 
| 
       160 
158 
     | 
    
         
             
                  end
         
     | 
| 
       161 
159 
     | 
    
         | 
| 
       162 
     | 
    
         
            -
                  it( 
     | 
| 
       163 
     | 
    
         
            -
                    @info_hash[ RCAP::CAP_1_0::Info::LANGUAGE_KEY 
     | 
| 
      
 160 
     | 
    
         
            +
                  it('should export the language correctly') do
         
     | 
| 
      
 161 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_0::Info::LANGUAGE_KEY].should == @info.language
         
     | 
| 
       164 
162 
     | 
    
         
             
                  end
         
     | 
| 
       165 
163 
     | 
    
         | 
| 
       166 
     | 
    
         
            -
                  it( 
     | 
| 
       167 
     | 
    
         
            -
                    @info_hash[ RCAP::CAP_1_0::Info::CATEGORIES_KEY 
     | 
| 
      
 164 
     | 
    
         
            +
                  it('should export the categories') do
         
     | 
| 
      
 165 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_0::Info::CATEGORIES_KEY].should == @info.categories
         
     | 
| 
       168 
166 
     | 
    
         
             
                  end
         
     | 
| 
       169 
167 
     | 
    
         | 
| 
       170 
     | 
    
         
            -
                  it( 
     | 
| 
       171 
     | 
    
         
            -
                    @info_hash[ RCAP::CAP_1_0::Info::EVENT_KEY 
     | 
| 
      
 168 
     | 
    
         
            +
                  it('should export the event') do
         
     | 
| 
      
 169 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_0::Info::EVENT_KEY].should == @info.event
         
     | 
| 
       172 
170 
     | 
    
         
             
                  end
         
     | 
| 
       173 
171 
     | 
    
         | 
| 
       174 
     | 
    
         
            -
                  it( 
     | 
| 
       175 
     | 
    
         
            -
                    @info_hash[ RCAP::CAP_1_0::Info:: URGENCY_KEY 
     | 
| 
      
 172 
     | 
    
         
            +
                  it('should export the urgency') do
         
     | 
| 
      
 173 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_0::Info:: URGENCY_KEY].should == @info.urgency
         
     | 
| 
       176 
174 
     | 
    
         
             
                  end
         
     | 
| 
       177 
175 
     | 
    
         | 
| 
       178 
     | 
    
         
            -
                  it( 
     | 
| 
       179 
     | 
    
         
            -
                    @info_hash[ RCAP::CAP_1_0::Info:: SEVERITY_KEY 
     | 
| 
      
 176 
     | 
    
         
            +
                  it('should export the severity') do
         
     | 
| 
      
 177 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_0::Info:: SEVERITY_KEY].should == @info.severity
         
     | 
| 
       180 
178 
     | 
    
         
             
                  end
         
     | 
| 
       181 
179 
     | 
    
         | 
| 
       182 
     | 
    
         
            -
                  it( 
     | 
| 
       183 
     | 
    
         
            -
                    @info_hash[ RCAP::CAP_1_0::Info:: CERTAINTY_KEY 
     | 
| 
      
 180 
     | 
    
         
            +
                  it('should export the certainty') do
         
     | 
| 
      
 181 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_0::Info:: CERTAINTY_KEY].should == @info.certainty
         
     | 
| 
       184 
182 
     | 
    
         
             
                  end
         
     | 
| 
       185 
183 
     | 
    
         | 
| 
       186 
     | 
    
         
            -
                  it( 
     | 
| 
       187 
     | 
    
         
            -
                    @info_hash[ RCAP::CAP_1_0::Info:: AUDIENCE_KEY 
     | 
| 
      
 184 
     | 
    
         
            +
                  it('should export the audience') do
         
     | 
| 
      
 185 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_0::Info:: AUDIENCE_KEY].should == @info.audience
         
     | 
| 
       188 
186 
     | 
    
         
             
                  end
         
     | 
| 
       189 
187 
     | 
    
         | 
| 
       190 
     | 
    
         
            -
                  it( 
     | 
| 
       191 
     | 
    
         
            -
                    @info_hash[ RCAP::CAP_1_0::Info::EFFECTIVE_KEY 
     | 
| 
      
 188 
     | 
    
         
            +
                  it('should export the effective date') do
         
     | 
| 
      
 189 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_0::Info::EFFECTIVE_KEY].should == @info.effective.to_s_for_cap
         
     | 
| 
       192 
190 
     | 
    
         
             
                  end
         
     | 
| 
       193 
191 
     | 
    
         | 
| 
       194 
     | 
    
         
            -
                  it( 
     | 
| 
       195 
     | 
    
         
            -
                    @info_hash[ RCAP::CAP_1_0::Info::ONSET_KEY 
     | 
| 
      
 192 
     | 
    
         
            +
                  it('should export the onset date') do
         
     | 
| 
      
 193 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_0::Info::ONSET_KEY].should == @info.onset.to_s_for_cap
         
     | 
| 
       196 
194 
     | 
    
         
             
                  end
         
     | 
| 
       197 
195 
     | 
    
         | 
| 
       198 
     | 
    
         
            -
                  it( 
     | 
| 
       199 
     | 
    
         
            -
                    @info_hash[ RCAP::CAP_1_0::Info::EXPIRES_KEY 
     | 
| 
      
 196 
     | 
    
         
            +
                  it('should export the expires date') do
         
     | 
| 
      
 197 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_0::Info::EXPIRES_KEY].should == @info.expires.to_s_for_cap
         
     | 
| 
       200 
198 
     | 
    
         
             
                  end
         
     | 
| 
       201 
199 
     | 
    
         | 
| 
       202 
     | 
    
         
            -
             
     | 
| 
       203 
     | 
    
         
            -
             
     | 
| 
       204 
     | 
    
         
            -
             
     | 
| 
      
 200 
     | 
    
         
            +
                  it('should export the sender name') do
         
     | 
| 
      
 201 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_0::Info::SENDER_NAME_KEY].should == @info.sender_name
         
     | 
| 
      
 202 
     | 
    
         
            +
                  end
         
     | 
| 
       205 
203 
     | 
    
         | 
| 
       206 
     | 
    
         
            -
             
     | 
| 
       207 
     | 
    
         
            -
             
     | 
| 
       208 
     | 
    
         
            -
             
     | 
| 
      
 204 
     | 
    
         
            +
                  it('should export the headline') do
         
     | 
| 
      
 205 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_0::Info::HEADLINE_KEY].should == @info.headline
         
     | 
| 
      
 206 
     | 
    
         
            +
                  end
         
     | 
| 
       209 
207 
     | 
    
         | 
| 
       210 
     | 
    
         
            -
             
     | 
| 
       211 
     | 
    
         
            -
             
     | 
| 
       212 
     | 
    
         
            -
             
     | 
| 
      
 208 
     | 
    
         
            +
                  it('should export the description') do
         
     | 
| 
      
 209 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_0::Info::DESCRIPTION_KEY].should == @info.description
         
     | 
| 
      
 210 
     | 
    
         
            +
                  end
         
     | 
| 
       213 
211 
     | 
    
         | 
| 
       214 
     | 
    
         
            -
             
     | 
| 
       215 
     | 
    
         
            -
             
     | 
| 
       216 
     | 
    
         
            -
             
     | 
| 
      
 212 
     | 
    
         
            +
                  it('should export the instruction') do
         
     | 
| 
      
 213 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_0::Info::INSTRUCTION_KEY].should == @info.instruction
         
     | 
| 
      
 214 
     | 
    
         
            +
                  end
         
     | 
| 
       217 
215 
     | 
    
         | 
| 
       218 
     | 
    
         
            -
             
     | 
| 
       219 
     | 
    
         
            -
             
     | 
| 
       220 
     | 
    
         
            -
             
     | 
| 
      
 216 
     | 
    
         
            +
                  it('should export the web address ') do
         
     | 
| 
      
 217 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_0::Info::WEB_KEY].should == @info.web
         
     | 
| 
      
 218 
     | 
    
         
            +
                  end
         
     | 
| 
       221 
219 
     | 
    
         | 
| 
       222 
     | 
    
         
            -
             
     | 
| 
       223 
     | 
    
         
            -
             
     | 
| 
       224 
     | 
    
         
            -
             
     | 
| 
      
 220 
     | 
    
         
            +
                  it('should export the contact') do
         
     | 
| 
      
 221 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_0::Info::CONTACT_KEY].should == @info.contact
         
     | 
| 
      
 222 
     | 
    
         
            +
                  end
         
     | 
| 
       225 
223 
     | 
    
         | 
| 
       226 
     | 
    
         
            -
             
     | 
| 
       227 
     | 
    
         
            -
             
     | 
| 
       228 
     | 
    
         
            -
             
     | 
| 
      
 224 
     | 
    
         
            +
                  it('should export the event codes') do
         
     | 
| 
      
 225 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_0::Info::EVENT_CODES_KEY].should == @info.event_codes.map { |event_code| event_code.to_h }
         
     | 
| 
      
 226 
     | 
    
         
            +
                  end
         
     | 
| 
       229 
227 
     | 
    
         | 
| 
       230 
     | 
    
         
            -
             
     | 
| 
       231 
     | 
    
         
            -
             
     | 
| 
       232 
     | 
    
         
            -
             
     | 
| 
      
 228 
     | 
    
         
            +
                  it('should export the parameters ') do
         
     | 
| 
      
 229 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_0::Info::PARAMETERS_KEY].should == @info.parameters.map { |parameter| parameter.to_h }
         
     | 
| 
      
 230 
     | 
    
         
            +
                  end
         
     | 
| 
       233 
231 
     | 
    
         | 
| 
       234 
     | 
    
         
            -
             
     | 
| 
       235 
     | 
    
         
            -
             
     | 
| 
       236 
     | 
    
         
            -
             
     | 
| 
      
 232 
     | 
    
         
            +
                  it('should export the resources ') do
         
     | 
| 
      
 233 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_0::Info::RESOURCES_KEY].should == @info.resources.map { |resource| resource.to_h }
         
     | 
| 
      
 234 
     | 
    
         
            +
                  end
         
     | 
| 
       237 
235 
     | 
    
         | 
| 
       238 
     | 
    
         
            -
             
     | 
| 
       239 
     | 
    
         
            -
             
     | 
| 
       240 
     | 
    
         
            -
             
     | 
| 
      
 236 
     | 
    
         
            +
                  it('should export the areas') do
         
     | 
| 
      
 237 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_0::Info::AREAS_KEY].should == @info.areas.map { |area| area.to_h }
         
     | 
| 
      
 238 
     | 
    
         
            +
                  end
         
     | 
| 
       241 
239 
     | 
    
         
             
                end
         
     | 
| 
       242 
240 
     | 
    
         
             
              end
         
     | 
| 
       243 
241 
     | 
    
         | 
| 
       244 
     | 
    
         
            -
              describe( 
     | 
| 
       245 
     | 
    
         
            -
                before( 
     | 
| 
      
 242 
     | 
    
         
            +
              describe('instance methods') do
         
     | 
| 
      
 243 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
       246 
244 
     | 
    
         
             
                  @info = RCAP::CAP_1_0::Info.new
         
     | 
| 
       247 
245 
     | 
    
         
             
                end
         
     | 
| 
       248 
246 
     | 
    
         | 
| 
       249 
     | 
    
         
            -
                describe( 
     | 
| 
       250 
     | 
    
         
            -
                  before( 
     | 
| 
      
 247 
     | 
    
         
            +
                describe('#add_event_code') do
         
     | 
| 
      
 248 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
       251 
249 
     | 
    
         
             
                    @event_code = @info.add_event_code do |event_code|
         
     | 
| 
       252 
     | 
    
         
            -
             
     | 
| 
       253 
     | 
    
         
            -
             
     | 
| 
      
 250 
     | 
    
         
            +
                      event_code.name = 'Event Code'
         
     | 
| 
      
 251 
     | 
    
         
            +
                      event_code.value = '1234'
         
     | 
| 
       254 
252 
     | 
    
         
             
                    end
         
     | 
| 
       255 
253 
     | 
    
         
             
                  end
         
     | 
| 
       256 
254 
     | 
    
         | 
| 
       257 
     | 
    
         
            -
                  it( 
     | 
| 
      
 255 
     | 
    
         
            +
                  it('should return a 1.0 EventCode') do
         
     | 
| 
       258 
256 
     | 
    
         
             
                    @event_code.class.should == RCAP::CAP_1_0::EventCode
         
     | 
| 
       259 
257 
     | 
    
         
             
                    @event_code.name.should == 'Event Code'
         
     | 
| 
       260 
258 
     | 
    
         
             
                    @event_code.value.should == '1234'
         
     | 
| 
       261 
259 
     | 
    
         
             
                  end
         
     | 
| 
       262 
260 
     | 
    
         | 
| 
       263 
     | 
    
         
            -
                  it( 
     | 
| 
      
 261 
     | 
    
         
            +
                  it('should add an EventCode to the event_codes attribute') do
         
     | 
| 
       264 
262 
     | 
    
         
             
                    @info.event_codes.size.should == 1
         
     | 
| 
       265 
263 
     | 
    
         
             
                  end
         
     | 
| 
       266 
264 
     | 
    
         
             
                end
         
     | 
| 
       267 
265 
     | 
    
         | 
| 
       268 
     | 
    
         
            -
                describe( 
     | 
| 
       269 
     | 
    
         
            -
                  before( 
     | 
| 
      
 266 
     | 
    
         
            +
                describe('#add_parameter') do
         
     | 
| 
      
 267 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
       270 
268 
     | 
    
         
             
                    @parameter = @info.add_parameter do |parameter|
         
     | 
| 
       271 
     | 
    
         
            -
             
     | 
| 
       272 
     | 
    
         
            -
             
     | 
| 
      
 269 
     | 
    
         
            +
                      parameter.name = 'Parameter'
         
     | 
| 
      
 270 
     | 
    
         
            +
                      parameter.value = '1234'
         
     | 
| 
       273 
271 
     | 
    
         
             
                    end
         
     | 
| 
       274 
272 
     | 
    
         
             
                  end
         
     | 
| 
       275 
273 
     | 
    
         | 
| 
       276 
     | 
    
         
            -
                  it( 
     | 
| 
      
 274 
     | 
    
         
            +
                  it('should return a 1.0 Parameter') do
         
     | 
| 
       277 
275 
     | 
    
         
             
                    @parameter.class.should == RCAP::CAP_1_0::Parameter
         
     | 
| 
       278 
276 
     | 
    
         
             
                    @parameter.name.should == 'Parameter'
         
     | 
| 
       279 
277 
     | 
    
         
             
                    @parameter.value.should == '1234'
         
     | 
| 
       280 
278 
     | 
    
         
             
                  end
         
     | 
| 
       281 
279 
     | 
    
         | 
| 
       282 
     | 
    
         
            -
                  it( 
     | 
| 
      
 280 
     | 
    
         
            +
                  it('should add a Parameter to the parameters attribute') do
         
     | 
| 
       283 
281 
     | 
    
         
             
                    @info.parameters.size.should == 1
         
     | 
| 
       284 
282 
     | 
    
         
             
                  end
         
     | 
| 
       285 
283 
     | 
    
         
             
                end
         
     | 
| 
       286 
284 
     | 
    
         | 
| 
       287 
     | 
    
         
            -
                describe( 
     | 
| 
       288 
     | 
    
         
            -
                  before( 
     | 
| 
      
 285 
     | 
    
         
            +
                describe('#add_resource') do
         
     | 
| 
      
 286 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
       289 
287 
     | 
    
         
             
                    @resource = @info.add_resource do |resource|
         
     | 
| 
       290 
288 
     | 
    
         
             
                      resource.resource_desc = 'Resource'
         
     | 
| 
       291 
289 
     | 
    
         
             
                    end
         
     | 
| 
       292 
290 
     | 
    
         
             
                  end
         
     | 
| 
       293 
291 
     | 
    
         | 
| 
       294 
     | 
    
         
            -
                  it( 
     | 
| 
      
 292 
     | 
    
         
            +
                  it('should return a 1.0 Resource') do
         
     | 
| 
       295 
293 
     | 
    
         
             
                    @resource.class.should == RCAP::CAP_1_0::Resource
         
     | 
| 
       296 
294 
     | 
    
         
             
                    @resource.resource_desc.should == 'Resource'
         
     | 
| 
       297 
295 
     | 
    
         
             
                  end
         
     | 
| 
       298 
296 
     | 
    
         | 
| 
       299 
     | 
    
         
            -
                  it( 
     | 
| 
      
 297 
     | 
    
         
            +
                  it('should add a Resource to the resources attribute') do
         
     | 
| 
       300 
298 
     | 
    
         
             
                    @info.resources.size.should == 1
         
     | 
| 
       301 
299 
     | 
    
         
             
                  end
         
     | 
| 
       302 
300 
     | 
    
         
             
                end
         
     | 
| 
       303 
301 
     | 
    
         | 
| 
       304 
     | 
    
         
            -
                describe( 
     | 
| 
       305 
     | 
    
         
            -
                  before( 
     | 
| 
      
 302 
     | 
    
         
            +
                describe('#add_area') do
         
     | 
| 
      
 303 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
       306 
304 
     | 
    
         
             
                    @area = @info.add_area do |area|
         
     | 
| 
       307 
305 
     | 
    
         
             
                      area.area_desc = 'Area'
         
     | 
| 
       308 
306 
     | 
    
         
             
                    end
         
     | 
| 
       309 
307 
     | 
    
         
             
                  end
         
     | 
| 
       310 
308 
     | 
    
         | 
| 
       311 
     | 
    
         
            -
                  it( 
     | 
| 
      
 309 
     | 
    
         
            +
                  it('should return a 1.0 area') do
         
     | 
| 
       312 
310 
     | 
    
         
             
                    @area.class.should == RCAP::CAP_1_0::Area
         
     | 
| 
       313 
311 
     | 
    
         
             
                    @area.area_desc.should == 'Area'
         
     | 
| 
       314 
312 
     | 
    
         
             
                  end
         
     | 
| 
       315 
313 
     | 
    
         | 
| 
       316 
     | 
    
         
            -
                  it( 
     | 
| 
      
 314 
     | 
    
         
            +
                  it('should add a Area to the areas attribute') do
         
     | 
| 
       317 
315 
     | 
    
         
             
                    @info.areas.size.should == 1
         
     | 
| 
       318 
316 
     | 
    
         
             
                  end
         
     | 
| 
       319 
317 
     | 
    
         
             
                end
         
     |