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_2/circle_spec.rb
    CHANGED
    
    | 
         @@ -1,100 +1,109 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            describe( 
     | 
| 
       4 
     | 
    
         
            -
              before( 
     | 
| 
      
 3 
     | 
    
         
            +
            describe(RCAP::CAP_1_2::Circle) do
         
     | 
| 
      
 4 
     | 
    
         
            +
              before(:each) do
         
     | 
| 
       5 
5 
     | 
    
         
             
                @circle_builder = lambda do |circle|
         
     | 
| 
       6 
6 
     | 
    
         
             
                  circle.lattitude = 0
         
     | 
| 
       7 
7 
     | 
    
         
             
                  circle.longitude = 0
         
     | 
| 
       8 
8 
     | 
    
         
             
                  circle.radius = 1
         
     | 
| 
       9 
9 
     | 
    
         
             
                end
         
     | 
| 
       10 
10 
     | 
    
         
             
              end
         
     | 
| 
       11 
     | 
    
         
            -
              describe( 
     | 
| 
       12 
     | 
    
         
            -
                it( 
     | 
| 
       13 
     | 
    
         
            -
                  @circle = RCAP::CAP_1_2::Circle.new( 
     | 
| 
      
 11 
     | 
    
         
            +
              describe('#to_s') do
         
     | 
| 
      
 12 
     | 
    
         
            +
                it('should return a correct string') do
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @circle = RCAP::CAP_1_2::Circle.new(&@circle_builder)
         
     | 
| 
       14 
14 
     | 
    
         
             
                  @circle.to_s.should == '0,0 1'
         
     | 
| 
       15 
15 
     | 
    
         
             
                end
         
     | 
| 
       16 
16 
     | 
    
         
             
              end
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
              context( 
     | 
| 
       19 
     | 
    
         
            -
                before( 
     | 
| 
       20 
     | 
    
         
            -
                  @circle = RCAP::CAP_1_2::Circle.new( 
     | 
| 
       21 
     | 
    
         
            -
                  @circle.should( 
     | 
| 
      
 18 
     | 
    
         
            +
              context('should not be valid if') do
         
     | 
| 
      
 19 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 20 
     | 
    
         
            +
                  @circle = RCAP::CAP_1_2::Circle.new(&@circle_builder)
         
     | 
| 
      
 21 
     | 
    
         
            +
                  @circle.should(be_valid)
         
     | 
| 
       22 
22 
     | 
    
         
             
                end
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
                it( 
     | 
| 
      
 24 
     | 
    
         
            +
                it('does not have a lattitude defined') do
         
     | 
| 
       25 
25 
     | 
    
         
             
                  @circle.lattitude = nil
         
     | 
| 
       26 
     | 
    
         
            -
                  @circle.should_not( 
     | 
| 
      
 26 
     | 
    
         
            +
                  @circle.should_not(be_valid)
         
     | 
| 
       27 
27 
     | 
    
         
             
                end
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
                it( 
     | 
| 
      
 29 
     | 
    
         
            +
                it('does not have a longitude defined') do
         
     | 
| 
       30 
30 
     | 
    
         
             
                  @circle.longitude = nil
         
     | 
| 
       31 
     | 
    
         
            -
                  @circle.should_not( 
     | 
| 
      
 31 
     | 
    
         
            +
                  @circle.should_not(be_valid)
         
     | 
| 
       32 
32 
     | 
    
         
             
                end
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
     | 
    
         
            -
                it( 
     | 
| 
      
 34 
     | 
    
         
            +
                it('does not have a radius defined') do
         
     | 
| 
       35 
35 
     | 
    
         
             
                  @circle.radius = nil
         
     | 
| 
       36 
     | 
    
         
            -
                  @circle.should_not( 
     | 
| 
      
 36 
     | 
    
         
            +
                  @circle.should_not(be_valid)
         
     | 
| 
       37 
37 
     | 
    
         
             
                end
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
                it( 
     | 
| 
       40 
     | 
    
         
            -
                  @circle.radius =  
     | 
| 
       41 
     | 
    
         
            -
                  @circle.should_not( 
     | 
| 
      
 39 
     | 
    
         
            +
                it('does not have a numeric radius') do
         
     | 
| 
      
 40 
     | 
    
         
            +
                  @circle.radius = 'not a number'
         
     | 
| 
      
 41 
     | 
    
         
            +
                  @circle.should_not(be_valid)
         
     | 
| 
       42 
42 
     | 
    
         
             
                end
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
       44 
     | 
    
         
            -
                it( 
     | 
| 
      
 44 
     | 
    
         
            +
                it('does not have a positive radius') do
         
     | 
| 
       45 
45 
     | 
    
         
             
                  @circle.radius = -1
         
     | 
| 
       46 
     | 
    
         
            -
                  @circle.should_not( 
     | 
| 
      
 46 
     | 
    
         
            +
                  @circle.should_not(be_valid)
         
     | 
| 
       47 
47 
     | 
    
         
             
                end
         
     | 
| 
       48 
48 
     | 
    
         
             
              end
         
     | 
| 
       49 
49 
     | 
    
         | 
| 
       50 
     | 
    
         
            -
              context( 
     | 
| 
       51 
     | 
    
         
            -
                context( 
     | 
| 
       52 
     | 
    
         
            -
                  before( 
     | 
| 
       53 
     | 
    
         
            -
                    @original_circle = RCAP::CAP_1_2::Circle.new( 
     | 
| 
      
 50 
     | 
    
         
            +
              context('on initialisation') do
         
     | 
| 
      
 51 
     | 
    
         
            +
                context('from XML') do
         
     | 
| 
      
 52 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
      
 53 
     | 
    
         
            +
                    @original_circle = RCAP::CAP_1_2::Circle.new(&@circle_builder)
         
     | 
| 
       54 
54 
     | 
    
         
             
                    @alert = RCAP::CAP_1_2::Alert.new
         
     | 
| 
       55 
     | 
    
         
            -
                    @alert.add_info.add_area.add_circle( 
     | 
| 
      
 55 
     | 
    
         
            +
                    @alert.add_info.add_area.add_circle(&@circle_builder)
         
     | 
| 
       56 
56 
     | 
    
         
             
                    @xml_string = @alert.to_xml
         
     | 
| 
       57 
     | 
    
         
            -
                    @xml_document = REXML::Document.new( 
     | 
| 
       58 
     | 
    
         
            -
                    @info_element = RCAP.xpath_first( 
     | 
| 
       59 
     | 
    
         
            -
                    @area_element = RCAP.xpath_first( 
     | 
| 
       60 
     | 
    
         
            -
                    @circle_element = RCAP.xpath_first( 
     | 
| 
       61 
     | 
    
         
            -
                    @circle = RCAP::CAP_1_2::Circle.from_xml_element( 
     | 
| 
      
 57 
     | 
    
         
            +
                    @xml_document = REXML::Document.new(@xml_string)
         
     | 
| 
      
 58 
     | 
    
         
            +
                    @info_element = RCAP.xpath_first(@xml_document.root, RCAP::CAP_1_2::Info::XPATH, RCAP::CAP_1_2::Alert::XMLNS)
         
     | 
| 
      
 59 
     | 
    
         
            +
                    @area_element = RCAP.xpath_first(@info_element, RCAP::CAP_1_2::Area::XPATH, RCAP::CAP_1_2::Alert::XMLNS)
         
     | 
| 
      
 60 
     | 
    
         
            +
                    @circle_element = RCAP.xpath_first(@area_element, RCAP::CAP_1_2::Circle::XPATH, RCAP::CAP_1_2::Alert::XMLNS)
         
     | 
| 
      
 61 
     | 
    
         
            +
                    @circle = RCAP::CAP_1_2::Circle.from_xml_element(@circle_element)
         
     | 
| 
       62 
62 
     | 
    
         
             
                  end
         
     | 
| 
       63 
63 
     | 
    
         | 
| 
       64 
     | 
    
         
            -
                  it( 
     | 
| 
      
 64 
     | 
    
         
            +
                  it('should parse the radius correctly') do
         
     | 
| 
       65 
65 
     | 
    
         
             
                    @circle.radius.should == @original_circle.radius
         
     | 
| 
       66 
66 
     | 
    
         
             
                  end
         
     | 
| 
       67 
67 
     | 
    
         | 
| 
       68 
     | 
    
         
            -
                  it( 
     | 
| 
      
 68 
     | 
    
         
            +
                  it('should parse the lattitude and longitude correctly') do
         
     | 
| 
       69 
69 
     | 
    
         
             
                    @circle.lattitude.should == @original_circle.lattitude
         
     | 
| 
       70 
70 
     | 
    
         
             
                    @circle.longitude.should == @original_circle.longitude
         
     | 
| 
       71 
71 
     | 
    
         
             
                  end
         
     | 
| 
       72 
72 
     | 
    
         
             
                end
         
     | 
| 
       73 
73 
     | 
    
         | 
| 
       74 
     | 
    
         
            -
                context( 
     | 
| 
       75 
     | 
    
         
            -
                  before( 
     | 
| 
       76 
     | 
    
         
            -
                    @original_circle = RCAP::CAP_1_2::Circle.new( 
     | 
| 
       77 
     | 
    
         
            -
                    @circle = RCAP::CAP_1_2::Circle.from_h( 
     | 
| 
      
 74 
     | 
    
         
            +
                context('from a hash') do
         
     | 
| 
      
 75 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
      
 76 
     | 
    
         
            +
                    @original_circle = RCAP::CAP_1_2::Circle.new(&@circle_builder)
         
     | 
| 
      
 77 
     | 
    
         
            +
                    @circle = RCAP::CAP_1_2::Circle.from_h(@original_circle.to_h)
         
     | 
| 
       78 
78 
     | 
    
         
             
                  end
         
     | 
| 
       79 
79 
     | 
    
         | 
| 
       80 
     | 
    
         
            -
                  it( 
     | 
| 
      
 80 
     | 
    
         
            +
                  it('should set the radius correctly') do
         
     | 
| 
       81 
81 
     | 
    
         
             
                    @circle.radius.should == @original_circle.radius
         
     | 
| 
       82 
82 
     | 
    
         
             
                  end
         
     | 
| 
       83 
83 
     | 
    
         | 
| 
       84 
     | 
    
         
            -
                  it( 
     | 
| 
      
 84 
     | 
    
         
            +
                  it('should parse the lattitude and longitude correctly') do
         
     | 
| 
       85 
85 
     | 
    
         
             
                    @circle.lattitude.should == @original_circle.lattitude
         
     | 
| 
       86 
86 
     | 
    
         
             
                    @circle.longitude.should == @original_circle.longitude
         
     | 
| 
       87 
87 
     | 
    
         
             
                  end
         
     | 
| 
       88 
88 
     | 
    
         
             
                end
         
     | 
| 
       89 
89 
     | 
    
         
             
              end
         
     | 
| 
       90 
90 
     | 
    
         | 
| 
       91 
     | 
    
         
            -
              context( 
     | 
| 
       92 
     | 
    
         
            -
                before( 
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
      
 91 
     | 
    
         
            +
              context('when exported') do
         
     | 
| 
      
 92 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 93 
     | 
    
         
            +
                  @circle = RCAP::CAP_1_2::Circle.new(&@circle_builder)
         
     | 
| 
       94 
94 
     | 
    
         
             
                end
         
     | 
| 
       95 
95 
     | 
    
         | 
| 
       96 
     | 
    
         
            -
                context( 
     | 
| 
       97 
     | 
    
         
            -
                  it( 
     | 
| 
      
 96 
     | 
    
         
            +
                context('to geojson') do
         
     | 
| 
      
 97 
     | 
    
         
            +
                  it('should be valid geojson') do
         
     | 
| 
      
 98 
     | 
    
         
            +
                    @circle.longitude = 5.6
         
     | 
| 
      
 99 
     | 
    
         
            +
                    expected = '{"type":"Feature","geometry":{"type":"Point",' \
         
     | 
| 
      
 100 
     | 
    
         
            +
                      '"coordinates":[5.6,0]},"properties":{"radius":1}}'
         
     | 
| 
      
 101 
     | 
    
         
            +
                    expect(@circle.to_geojson).to eq expected
         
     | 
| 
      
 102 
     | 
    
         
            +
                  end
         
     | 
| 
      
 103 
     | 
    
         
            +
                end
         
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
      
 105 
     | 
    
         
            +
                context('to hash') do
         
     | 
| 
      
 106 
     | 
    
         
            +
                  it('should be correct') do
         
     | 
| 
       98 
107 
     | 
    
         
             
                    @circle.to_h.should == { 'radius' => 1, 'lattitude' => 0, 'longitude' => 0 }
         
     | 
| 
       99 
108 
     | 
    
         
             
                  end
         
     | 
| 
       100 
109 
     | 
    
         
             
                end
         
     | 
| 
         @@ -1,50 +1,49 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            describe( 
     | 
| 
       4 
     | 
    
         
            -
              before( 
     | 
| 
      
 3 
     | 
    
         
            +
            describe(RCAP::CAP_1_2::EventCode) do
         
     | 
| 
      
 4 
     | 
    
         
            +
              before(:each) do
         
     | 
| 
       5 
5 
     | 
    
         
             
                @event_code_builder = lambda do |event_code|
         
     | 
| 
       6 
6 
     | 
    
         
             
                  event_code.name = 'name'
         
     | 
| 
       7 
7 
     | 
    
         
             
                  event_code.value = 'value'
         
     | 
| 
       8 
8 
     | 
    
         
             
                end
         
     | 
| 
       9 
9 
     | 
    
         
             
              end
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
              context( 
     | 
| 
       12 
     | 
    
         
            -
                context( 
     | 
| 
       13 
     | 
    
         
            -
                  before( 
     | 
| 
       14 
     | 
    
         
            -
                    @original_event_code = RCAP::CAP_1_2::EventCode.new( 
     | 
| 
      
 11 
     | 
    
         
            +
              context('when initialised') do
         
     | 
| 
      
 12 
     | 
    
         
            +
                context('from XML') do
         
     | 
| 
      
 13 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
      
 14 
     | 
    
         
            +
                    @original_event_code = RCAP::CAP_1_2::EventCode.new(&@event_code_builder)
         
     | 
| 
       15 
15 
     | 
    
         
             
                    @alert = RCAP::CAP_1_2::Alert.new
         
     | 
| 
       16 
     | 
    
         
            -
                    @alert.add_info.add_event_code( 
     | 
| 
      
 16 
     | 
    
         
            +
                    @alert.add_info.add_event_code(&@event_code_builder)
         
     | 
| 
       17 
17 
     | 
    
         
             
                    @xml_string = @alert.to_xml
         
     | 
| 
       18 
     | 
    
         
            -
                    @xml_document = REXML::Document.new( 
     | 
| 
       19 
     | 
    
         
            -
                    @info_xml_element = RCAP.xpath_first( 
     | 
| 
       20 
     | 
    
         
            -
                    @event_code_xml_element = RCAP.xpath_first( 
     | 
| 
       21 
     | 
    
         
            -
                    @event_code = RCAP::CAP_1_2::EventCode.from_xml_element( 
     | 
| 
      
 18 
     | 
    
         
            +
                    @xml_document = REXML::Document.new(@xml_string)
         
     | 
| 
      
 19 
     | 
    
         
            +
                    @info_xml_element = RCAP.xpath_first(@xml_document.root, RCAP::CAP_1_2::Info::XPATH, RCAP::CAP_1_2::Alert::XMLNS)
         
     | 
| 
      
 20 
     | 
    
         
            +
                    @event_code_xml_element = RCAP.xpath_first(@info_xml_element, RCAP::CAP_1_2::EventCode::XPATH, RCAP::CAP_1_2::Alert::XMLNS)
         
     | 
| 
      
 21 
     | 
    
         
            +
                    @event_code = RCAP::CAP_1_2::EventCode.from_xml_element(@event_code_xml_element)
         
     | 
| 
       22 
22 
     | 
    
         
             
                  end
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
                  it( 
     | 
| 
      
 24 
     | 
    
         
            +
                  it('should parse into the correct class') do
         
     | 
| 
       25 
25 
     | 
    
         
             
                    @event_code.class.should == RCAP::CAP_1_2::EventCode
         
     | 
| 
       26 
26 
     | 
    
         
             
                  end
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
     | 
    
         
            -
                  it( 
     | 
| 
      
 28 
     | 
    
         
            +
                  it('should parse the name correctly') do
         
     | 
| 
       29 
29 
     | 
    
         
             
                    @event_code.name.should == @original_event_code.name
         
     | 
| 
       30 
30 
     | 
    
         
             
                  end
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
                  it( 
     | 
| 
      
 32 
     | 
    
         
            +
                  it('should parse the value correctly') do
         
     | 
| 
       33 
33 
     | 
    
         
             
                    @event_code.value.should == @original_event_code.value
         
     | 
| 
       34 
34 
     | 
    
         
             
                  end
         
     | 
| 
       35 
35 
     | 
    
         
             
                end
         
     | 
| 
       36 
36 
     | 
    
         
             
              end
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
     | 
    
         
            -
              context( 
     | 
| 
       39 
     | 
    
         
            -
                before( 
     | 
| 
       40 
     | 
    
         
            -
                  @event_code = RCAP::CAP_1_2::EventCode.new( 
     | 
| 
      
 38 
     | 
    
         
            +
              context('when exported') do
         
     | 
| 
      
 39 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 40 
     | 
    
         
            +
                  @event_code = RCAP::CAP_1_2::EventCode.new(&@event_code_builder)
         
     | 
| 
       41 
41 
     | 
    
         
             
                end
         
     | 
| 
       42 
42 
     | 
    
         | 
| 
       43 
     | 
    
         
            -
                context( 
     | 
| 
       44 
     | 
    
         
            -
                  it( 
     | 
| 
      
 43 
     | 
    
         
            +
                context('to a hash') do
         
     | 
| 
      
 44 
     | 
    
         
            +
                  it('should export correctly') do
         
     | 
| 
       45 
45 
     | 
    
         
             
                    @event_code.to_h.should == { 'name' => 'value' }
         
     | 
| 
       46 
46 
     | 
    
         
             
                  end
         
     | 
| 
       47 
47 
     | 
    
         
             
                end
         
     | 
| 
       48 
48 
     | 
    
         
             
              end
         
     | 
| 
       49 
49 
     | 
    
         
             
            end
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
         @@ -1,48 +1,48 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            describe( 
     | 
| 
       4 
     | 
    
         
            -
              before( 
     | 
| 
      
 3 
     | 
    
         
            +
            describe(RCAP::CAP_1_2::Geocode) do
         
     | 
| 
      
 4 
     | 
    
         
            +
              before(:each) do
         
     | 
| 
       5 
5 
     | 
    
         
             
                @geocode_builder = lambda do |geocode|
         
     | 
| 
       6 
6 
     | 
    
         
             
                  geocode.name = 'name'
         
     | 
| 
       7 
7 
     | 
    
         
             
                  geocode.value = 'value'
         
     | 
| 
       8 
8 
     | 
    
         
             
                end
         
     | 
| 
       9 
9 
     | 
    
         
             
              end
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
              context( 
     | 
| 
       12 
     | 
    
         
            -
                context( 
     | 
| 
       13 
     | 
    
         
            -
                  before( 
     | 
| 
       14 
     | 
    
         
            -
                    @original_geocode = RCAP::CAP_1_2::Geocode.new( 
     | 
| 
      
 11 
     | 
    
         
            +
              context('when initialised') do
         
     | 
| 
      
 12 
     | 
    
         
            +
                context('from XML') do
         
     | 
| 
      
 13 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
      
 14 
     | 
    
         
            +
                    @original_geocode = RCAP::CAP_1_2::Geocode.new(&@geocode_builder)
         
     | 
| 
       15 
15 
     | 
    
         
             
                    @alert = RCAP::CAP_1_2::Alert.new
         
     | 
| 
       16 
     | 
    
         
            -
                    @alert.add_info.add_area.add_geocode( 
     | 
| 
      
 16 
     | 
    
         
            +
                    @alert.add_info.add_area.add_geocode(&@geocode_builder)
         
     | 
| 
       17 
17 
     | 
    
         
             
                    @xml_string = @alert.to_xml
         
     | 
| 
       18 
     | 
    
         
            -
                    @xml_document = REXML::Document.new( 
     | 
| 
       19 
     | 
    
         
            -
                    @info_xml_element = RCAP.xpath_first( 
     | 
| 
       20 
     | 
    
         
            -
                    @area_xml_element = RCAP.xpath_first( 
     | 
| 
       21 
     | 
    
         
            -
                    @geocode_xml_element = RCAP.xpath_first( 
     | 
| 
       22 
     | 
    
         
            -
                    @geocode = RCAP::CAP_1_2::Geocode.from_xml_element( 
     | 
| 
      
 18 
     | 
    
         
            +
                    @xml_document = REXML::Document.new(@xml_string)
         
     | 
| 
      
 19 
     | 
    
         
            +
                    @info_xml_element = RCAP.xpath_first(@xml_document.root, RCAP::CAP_1_2::Info::XPATH, RCAP::CAP_1_2::Alert::XMLNS)
         
     | 
| 
      
 20 
     | 
    
         
            +
                    @area_xml_element = RCAP.xpath_first(@info_xml_element, RCAP::CAP_1_2::Area::XPATH, RCAP::CAP_1_2::Alert::XMLNS)
         
     | 
| 
      
 21 
     | 
    
         
            +
                    @geocode_xml_element = RCAP.xpath_first(@area_xml_element, RCAP::CAP_1_2::Geocode::XPATH, RCAP::CAP_1_2::Alert::XMLNS)
         
     | 
| 
      
 22 
     | 
    
         
            +
                    @geocode = RCAP::CAP_1_2::Geocode.from_xml_element(@geocode_xml_element)
         
     | 
| 
       23 
23 
     | 
    
         
             
                  end
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
                  it( 
     | 
| 
      
 25 
     | 
    
         
            +
                  it('should parse into the correct class') do
         
     | 
| 
       26 
26 
     | 
    
         
             
                    @geocode.class.should == RCAP::CAP_1_2::Geocode
         
     | 
| 
       27 
27 
     | 
    
         
             
                  end
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
                  it( 
     | 
| 
      
 29 
     | 
    
         
            +
                  it('should parse the name correctly') do
         
     | 
| 
       30 
30 
     | 
    
         
             
                    @geocode.name.should == @original_geocode.name
         
     | 
| 
       31 
31 
     | 
    
         
             
                  end
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
                  it( 
     | 
| 
      
 33 
     | 
    
         
            +
                  it('should parse the value correctly') do
         
     | 
| 
       34 
34 
     | 
    
         
             
                    @geocode.value.should == @original_geocode.value
         
     | 
| 
       35 
35 
     | 
    
         
             
                  end
         
     | 
| 
       36 
36 
     | 
    
         
             
                end
         
     | 
| 
       37 
37 
     | 
    
         
             
              end
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
              context( 
     | 
| 
       40 
     | 
    
         
            -
                before( 
     | 
| 
       41 
     | 
    
         
            -
                  @geocode = RCAP::CAP_1_2::Geocode.new( 
     | 
| 
      
 39 
     | 
    
         
            +
              context('when exported') do
         
     | 
| 
      
 40 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 41 
     | 
    
         
            +
                  @geocode = RCAP::CAP_1_2::Geocode.new(&@geocode_builder)
         
     | 
| 
       42 
42 
     | 
    
         
             
                end
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
       44 
     | 
    
         
            -
                context( 
     | 
| 
       45 
     | 
    
         
            -
                  it( 
     | 
| 
      
 44 
     | 
    
         
            +
                context('to a hash') do
         
     | 
| 
      
 45 
     | 
    
         
            +
                  it('should export correctly') do
         
     | 
| 
       46 
46 
     | 
    
         
             
                    @geocode.to_h.should == { 'name' => 'value' }
         
     | 
| 
       47 
47 
     | 
    
         
             
                  end
         
     | 
| 
       48 
48 
     | 
    
         
             
                end
         
     | 
    
        data/spec/cap_1_2/info_spec.rb
    CHANGED
    
    | 
         @@ -1,12 +1,12 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            describe( 
     | 
| 
       4 
     | 
    
         
            -
              before( 
     | 
| 
      
 3 
     | 
    
         
            +
            describe(RCAP::CAP_1_2::Info) do
         
     | 
| 
      
 4 
     | 
    
         
            +
              before(:each) do
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
                @info_builder = lambda do |info|
         
     | 
| 
       7 
7 
     | 
    
         
             
                  info.categories << RCAP::CAP_1_2::Info::CATEGORY_GEO
         
     | 
| 
       8 
8 
     | 
    
         
             
                  info.categories << RCAP::CAP_1_2::Info::CATEGORY_FIRE
         
     | 
| 
       9 
     | 
    
         
            -
                  info.event ='Event Description'
         
     | 
| 
      
 9 
     | 
    
         
            +
                  info.event = 'Event Description'
         
     | 
| 
       10 
10 
     | 
    
         
             
                  info.response_types << RCAP::CAP_1_2::Info::RESPONSE_TYPE_MONITOR
         
     | 
| 
       11 
11 
     | 
    
         
             
                  info.response_types << RCAP::CAP_1_2::Info::RESPONSE_TYPE_ASSESS
         
     | 
| 
       12 
12 
     | 
    
         
             
                  info.urgency = RCAP::CAP_1_2::Info::URGENCY_IMMEDIATE
         
     | 
| 
         @@ -22,7 +22,7 @@ describe( RCAP::CAP_1_2::Info ) do 
     | 
|
| 
       22 
22 
     | 
    
         
             
                  info.instruction = 'Instruction'
         
     | 
| 
       23 
23 
     | 
    
         
             
                  info.web = 'http://website'
         
     | 
| 
       24 
24 
     | 
    
         
             
                  info.contact = 'contact@address'
         
     | 
| 
       25 
     | 
    
         
            -
                  [ 
     | 
| 
      
 25 
     | 
    
         
            +
                  [%w(name1 value1), %w(name2 value2)].each do |name, value|
         
     | 
| 
       26 
26 
     | 
    
         
             
                    info.add_event_code do |event_code|
         
     | 
| 
       27 
27 
     | 
    
         
             
                      event_code.name = name
         
     | 
| 
       28 
28 
     | 
    
         
             
                      event_code.value = value
         
     | 
| 
         @@ -30,18 +30,18 @@ describe( RCAP::CAP_1_2::Info ) do 
     | 
|
| 
       30 
30 
     | 
    
         
             
                  end
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
32 
     | 
    
         
             
                  info.add_resource do |resource|
         
     | 
| 
       33 
     | 
    
         
            -
                    resource.resource_desc =  
     | 
| 
       34 
     | 
    
         
            -
                    resource.mime_type =  
     | 
| 
      
 33 
     | 
    
         
            +
                    resource.resource_desc = 'Resource'
         
     | 
| 
      
 34 
     | 
    
         
            +
                    resource.mime_type = 'mime/type'
         
     | 
| 
       35 
35 
     | 
    
         
             
                  end
         
     | 
| 
       36 
36 
     | 
    
         | 
| 
       37 
     | 
    
         
            -
                  [ 
     | 
| 
      
 37 
     | 
    
         
            +
                  [%w(name1 value1), %w(name2 value2)].each do |name, value|
         
     | 
| 
       38 
38 
     | 
    
         
             
                    info.add_parameter do |parameter|
         
     | 
| 
       39 
39 
     | 
    
         
             
                      parameter.name = name
         
     | 
| 
       40 
40 
     | 
    
         
             
                      parameter.value = value
         
     | 
| 
       41 
41 
     | 
    
         
             
                    end
         
     | 
| 
       42 
42 
     | 
    
         
             
                  end
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
       44 
     | 
    
         
            -
                   
     | 
| 
      
 44 
     | 
    
         
            +
                  %w(Area1 Area2).each do |area_desc|
         
     | 
| 
       45 
45 
     | 
    
         
             
                    info.add_area do |area|
         
     | 
| 
       46 
46 
     | 
    
         
             
                      area.area_desc = area_desc
         
     | 
| 
       47 
47 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -49,181 +49,180 @@ describe( RCAP::CAP_1_2::Info ) do 
     | 
|
| 
       49 
49 
     | 
    
         
             
                end
         
     | 
| 
       50 
50 
     | 
    
         
             
              end
         
     | 
| 
       51 
51 
     | 
    
         | 
| 
       52 
     | 
    
         
            -
              context( 
     | 
| 
       53 
     | 
    
         
            -
                before( 
     | 
| 
      
 52 
     | 
    
         
            +
              context('on initialisation') do
         
     | 
| 
      
 53 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
       54 
54 
     | 
    
         
             
                  @info = RCAP::CAP_1_2::Info.new
         
     | 
| 
       55 
55 
     | 
    
         
             
                end
         
     | 
| 
       56 
56 
     | 
    
         | 
| 
       57 
     | 
    
         
            -
                it( 
     | 
| 
      
 57 
     | 
    
         
            +
                it('should have a default language of en-US') do
         
     | 
| 
       58 
58 
     | 
    
         
             
                  @info.language.should == 'en-US'
         
     | 
| 
       59 
59 
     | 
    
         
             
                end
         
     | 
| 
       60 
60 
     | 
    
         | 
| 
       61 
     | 
    
         
            -
                it( 
     | 
| 
       62 
     | 
    
         
            -
                  @info.categories.should( 
     | 
| 
      
 61 
     | 
    
         
            +
                it('should have no categories') do
         
     | 
| 
      
 62 
     | 
    
         
            +
                  @info.categories.should(be_empty)
         
     | 
| 
       63 
63 
     | 
    
         
             
                end
         
     | 
| 
       64 
64 
     | 
    
         | 
| 
       65 
     | 
    
         
            -
                it( 
     | 
| 
       66 
     | 
    
         
            -
                  @info.event.should( 
     | 
| 
      
 65 
     | 
    
         
            +
                it('should have no event') do
         
     | 
| 
      
 66 
     | 
    
         
            +
                  @info.event.should(be_nil)
         
     | 
| 
       67 
67 
     | 
    
         
             
                end
         
     | 
| 
       68 
68 
     | 
    
         | 
| 
       69 
     | 
    
         
            -
                it( 
     | 
| 
       70 
     | 
    
         
            -
                  @info.response_types.should( 
     | 
| 
      
 69 
     | 
    
         
            +
                it('should have no response types') do
         
     | 
| 
      
 70 
     | 
    
         
            +
                  @info.response_types.should(be_empty)
         
     | 
| 
       71 
71 
     | 
    
         
             
                end
         
     | 
| 
       72 
72 
     | 
    
         | 
| 
       73 
     | 
    
         
            -
                it( 
     | 
| 
       74 
     | 
    
         
            -
                  @info.urgency.should( 
     | 
| 
      
 73 
     | 
    
         
            +
                it('should have no urgency') do
         
     | 
| 
      
 74 
     | 
    
         
            +
                  @info.urgency.should(be_nil)
         
     | 
| 
       75 
75 
     | 
    
         
             
                end
         
     | 
| 
       76 
76 
     | 
    
         | 
| 
       77 
     | 
    
         
            -
                it( 
     | 
| 
       78 
     | 
    
         
            -
                  @info.severity.should( 
     | 
| 
      
 77 
     | 
    
         
            +
                it('should have no severity') do
         
     | 
| 
      
 78 
     | 
    
         
            +
                  @info.severity.should(be_nil)
         
     | 
| 
       79 
79 
     | 
    
         
             
                end
         
     | 
| 
       80 
80 
     | 
    
         | 
| 
       81 
     | 
    
         
            -
                it( 
     | 
| 
       82 
     | 
    
         
            -
                  @info.certainty.should( 
     | 
| 
      
 81 
     | 
    
         
            +
                it('should have no certainty') do
         
     | 
| 
      
 82 
     | 
    
         
            +
                  @info.certainty.should(be_nil)
         
     | 
| 
       83 
83 
     | 
    
         
             
                end
         
     | 
| 
       84 
84 
     | 
    
         | 
| 
       85 
     | 
    
         
            -
                it( 
     | 
| 
       86 
     | 
    
         
            -
                  @info.audience.should( 
     | 
| 
      
 85 
     | 
    
         
            +
                it('should have no audience') do
         
     | 
| 
      
 86 
     | 
    
         
            +
                  @info.audience.should(be_nil)
         
     | 
| 
       87 
87 
     | 
    
         
             
                end
         
     | 
| 
       88 
88 
     | 
    
         | 
| 
       89 
     | 
    
         
            -
                it( 
     | 
| 
       90 
     | 
    
         
            -
                  @info.event_codes.should( 
     | 
| 
      
 89 
     | 
    
         
            +
                it('should have no event_codes') do
         
     | 
| 
      
 90 
     | 
    
         
            +
                  @info.event_codes.should(be_empty)
         
     | 
| 
       91 
91 
     | 
    
         
             
                end
         
     | 
| 
       92 
92 
     | 
    
         | 
| 
       93 
     | 
    
         
            -
                it( 
     | 
| 
       94 
     | 
    
         
            -
                  @info.effective.should( 
     | 
| 
      
 93 
     | 
    
         
            +
                it('should have no effective datetime') do
         
     | 
| 
      
 94 
     | 
    
         
            +
                  @info.effective.should(be_nil)
         
     | 
| 
       95 
95 
     | 
    
         
             
                end
         
     | 
| 
       96 
96 
     | 
    
         | 
| 
       97 
     | 
    
         
            -
                it( 
     | 
| 
       98 
     | 
    
         
            -
                  @info.onset.should( 
     | 
| 
      
 97 
     | 
    
         
            +
                it('should have no onset datetime') do
         
     | 
| 
      
 98 
     | 
    
         
            +
                  @info.onset.should(be_nil)
         
     | 
| 
       99 
99 
     | 
    
         
             
                end
         
     | 
| 
       100 
100 
     | 
    
         | 
| 
       101 
     | 
    
         
            -
                it( 
     | 
| 
       102 
     | 
    
         
            -
                  @info.expires.should( 
     | 
| 
      
 101 
     | 
    
         
            +
                it('should have no expires datetime') do
         
     | 
| 
      
 102 
     | 
    
         
            +
                  @info.expires.should(be_nil)
         
     | 
| 
       103 
103 
     | 
    
         
             
                end
         
     | 
| 
       104 
104 
     | 
    
         | 
| 
       105 
     | 
    
         
            -
                it( 
     | 
| 
       106 
     | 
    
         
            -
                  @info.sender_name.should( 
     | 
| 
      
 105 
     | 
    
         
            +
                it('should have no sender name ') do
         
     | 
| 
      
 106 
     | 
    
         
            +
                  @info.sender_name.should(be_nil)
         
     | 
| 
       107 
107 
     | 
    
         
             
                end
         
     | 
| 
       108 
108 
     | 
    
         | 
| 
       109 
     | 
    
         
            -
                it( 
     | 
| 
       110 
     | 
    
         
            -
                  @info.headline.should( 
     | 
| 
      
 109 
     | 
    
         
            +
                it('should have no headline') do
         
     | 
| 
      
 110 
     | 
    
         
            +
                  @info.headline.should(be_nil)
         
     | 
| 
       111 
111 
     | 
    
         
             
                end
         
     | 
| 
       112 
112 
     | 
    
         | 
| 
       113 
     | 
    
         
            -
                it( 
     | 
| 
       114 
     | 
    
         
            -
                  @info.description.should( 
     | 
| 
      
 113 
     | 
    
         
            +
                it('should have no description') do
         
     | 
| 
      
 114 
     | 
    
         
            +
                  @info.description.should(be_nil)
         
     | 
| 
       115 
115 
     | 
    
         
             
                end
         
     | 
| 
       116 
116 
     | 
    
         | 
| 
       117 
     | 
    
         
            -
                it( 
     | 
| 
       118 
     | 
    
         
            -
                  @info.instruction.should( 
     | 
| 
      
 117 
     | 
    
         
            +
                it('should have no instruction') do
         
     | 
| 
      
 118 
     | 
    
         
            +
                  @info.instruction.should(be_nil)
         
     | 
| 
       119 
119 
     | 
    
         
             
                end
         
     | 
| 
       120 
120 
     | 
    
         | 
| 
       121 
     | 
    
         
            -
                it( 
     | 
| 
       122 
     | 
    
         
            -
                  @info.web.should( 
     | 
| 
      
 121 
     | 
    
         
            +
                it('should have no web') do
         
     | 
| 
      
 122 
     | 
    
         
            +
                  @info.web.should(be_nil)
         
     | 
| 
       123 
123 
     | 
    
         
             
                end
         
     | 
| 
       124 
124 
     | 
    
         | 
| 
       125 
     | 
    
         
            -
                it( 
     | 
| 
       126 
     | 
    
         
            -
                  @info.contact.should( 
     | 
| 
      
 125 
     | 
    
         
            +
                it('should have no contact') do
         
     | 
| 
      
 126 
     | 
    
         
            +
                  @info.contact.should(be_nil)
         
     | 
| 
       127 
127 
     | 
    
         
             
                end
         
     | 
| 
       128 
128 
     | 
    
         | 
| 
       129 
     | 
    
         
            -
                it( 
     | 
| 
       130 
     | 
    
         
            -
                  @info.parameters.should( 
     | 
| 
      
 129 
     | 
    
         
            +
                it('should have no parameters') do
         
     | 
| 
      
 130 
     | 
    
         
            +
                  @info.parameters.should(be_empty)
         
     | 
| 
       131 
131 
     | 
    
         
             
                end
         
     | 
| 
       132 
132 
     | 
    
         | 
| 
       133 
     | 
    
         
            -
             
     | 
| 
       134 
     | 
    
         
            -
             
     | 
| 
       135 
     | 
    
         
            -
             
     | 
| 
       136 
     | 
    
         
            -
                    @info.categories.should_not( be_empty )
         
     | 
| 
      
 133 
     | 
    
         
            +
                shared_examples_for('it can parse into a CAP 1.2 Info object') do
         
     | 
| 
      
 134 
     | 
    
         
            +
                  it('should parse categories correctly') do
         
     | 
| 
      
 135 
     | 
    
         
            +
                    @info.categories.should_not(be_empty)
         
     | 
| 
       137 
136 
     | 
    
         
             
                    @info.categories.should == @original_info.categories
         
     | 
| 
       138 
137 
     | 
    
         
             
                  end
         
     | 
| 
       139 
138 
     | 
    
         | 
| 
       140 
     | 
    
         
            -
                  it( 
     | 
| 
       141 
     | 
    
         
            -
                    @info.event.should_not( 
     | 
| 
      
 139 
     | 
    
         
            +
                  it('should parse event correctly') do
         
     | 
| 
      
 140 
     | 
    
         
            +
                    @info.event.should_not(be_nil)
         
     | 
| 
       142 
141 
     | 
    
         
             
                    @info.event.should == @original_info.event
         
     | 
| 
       143 
142 
     | 
    
         
             
                  end
         
     | 
| 
       144 
143 
     | 
    
         | 
| 
       145 
     | 
    
         
            -
                  it( 
     | 
| 
       146 
     | 
    
         
            -
                    @info.response_types.should_not( 
     | 
| 
      
 144 
     | 
    
         
            +
                  it('should parse response_types correctly') do
         
     | 
| 
      
 145 
     | 
    
         
            +
                    @info.response_types.should_not(be_nil)
         
     | 
| 
       147 
146 
     | 
    
         
             
                    @info.response_types.should == @original_info.response_types
         
     | 
| 
       148 
147 
     | 
    
         
             
                  end
         
     | 
| 
       149 
148 
     | 
    
         | 
| 
       150 
     | 
    
         
            -
                  it( 
     | 
| 
       151 
     | 
    
         
            -
                    @info.urgency.should_not( 
     | 
| 
      
 149 
     | 
    
         
            +
                  it('should parse urgency correctly') do
         
     | 
| 
      
 150 
     | 
    
         
            +
                    @info.urgency.should_not(be_nil)
         
     | 
| 
       152 
151 
     | 
    
         
             
                    @info.urgency.should == @original_info.urgency
         
     | 
| 
       153 
152 
     | 
    
         
             
                  end
         
     | 
| 
       154 
153 
     | 
    
         | 
| 
       155 
     | 
    
         
            -
                  it( 
     | 
| 
       156 
     | 
    
         
            -
                    @info.severity.should_not( 
     | 
| 
      
 154 
     | 
    
         
            +
                  it('should parse severity correctly') do
         
     | 
| 
      
 155 
     | 
    
         
            +
                    @info.severity.should_not(be_nil)
         
     | 
| 
       157 
156 
     | 
    
         
             
                    @info.severity.should == @original_info.severity
         
     | 
| 
       158 
157 
     | 
    
         
             
                  end
         
     | 
| 
       159 
158 
     | 
    
         | 
| 
       160 
     | 
    
         
            -
                  it( 
     | 
| 
       161 
     | 
    
         
            -
                    @info.certainty.should_not( 
     | 
| 
      
 159 
     | 
    
         
            +
                  it('should parse certainty correctly') do
         
     | 
| 
      
 160 
     | 
    
         
            +
                    @info.certainty.should_not(be_nil)
         
     | 
| 
       162 
161 
     | 
    
         
             
                    @info.certainty.should == @original_info.certainty
         
     | 
| 
       163 
162 
     | 
    
         
             
                  end
         
     | 
| 
       164 
163 
     | 
    
         | 
| 
       165 
     | 
    
         
            -
                  it( 
     | 
| 
       166 
     | 
    
         
            -
                    @info.audience.should_not( 
     | 
| 
      
 164 
     | 
    
         
            +
                  it('should parse audience correctly') do
         
     | 
| 
      
 165 
     | 
    
         
            +
                    @info.audience.should_not(be_nil)
         
     | 
| 
       167 
166 
     | 
    
         
             
                    @info.audience.should == @original_info.audience
         
     | 
| 
       168 
167 
     | 
    
         
             
                  end
         
     | 
| 
       169 
168 
     | 
    
         | 
| 
       170 
     | 
    
         
            -
                  it( 
     | 
| 
       171 
     | 
    
         
            -
                    @info.effective.should_not( 
     | 
| 
       172 
     | 
    
         
            -
                    @info.effective.should( 
     | 
| 
      
 169 
     | 
    
         
            +
                  it('should parse effective correctly') do
         
     | 
| 
      
 170 
     | 
    
         
            +
                    @info.effective.should_not(be_nil)
         
     | 
| 
      
 171 
     | 
    
         
            +
                    @info.effective.should(be_within(Rational(1, 86_400)).of(@original_info.effective))
         
     | 
| 
       173 
172 
     | 
    
         
             
                  end
         
     | 
| 
       174 
173 
     | 
    
         | 
| 
       175 
     | 
    
         
            -
                  it( 
     | 
| 
       176 
     | 
    
         
            -
                    @info.onset.should_not( 
     | 
| 
       177 
     | 
    
         
            -
                    @info.onset.should( 
     | 
| 
      
 174 
     | 
    
         
            +
                  it('should parse onset correctly') do
         
     | 
| 
      
 175 
     | 
    
         
            +
                    @info.onset.should_not(be_nil)
         
     | 
| 
      
 176 
     | 
    
         
            +
                    @info.onset.should(be_within(Rational(1, 86_400)).of(@original_info.onset))
         
     | 
| 
       178 
177 
     | 
    
         
             
                  end
         
     | 
| 
       179 
178 
     | 
    
         | 
| 
       180 
     | 
    
         
            -
                  it( 
     | 
| 
       181 
     | 
    
         
            -
                    @info.expires.should_not( 
     | 
| 
       182 
     | 
    
         
            -
                    @info.expires.should( 
     | 
| 
      
 179 
     | 
    
         
            +
                  it('should parse expires correctly') do
         
     | 
| 
      
 180 
     | 
    
         
            +
                    @info.expires.should_not(be_nil)
         
     | 
| 
      
 181 
     | 
    
         
            +
                    @info.expires.should(be_within(Rational(1, 86_400)).of(@original_info.expires))
         
     | 
| 
       183 
182 
     | 
    
         
             
                  end
         
     | 
| 
       184 
183 
     | 
    
         | 
| 
       185 
     | 
    
         
            -
                  it( 
     | 
| 
       186 
     | 
    
         
            -
                    @info.sender_name.should_not( 
     | 
| 
      
 184 
     | 
    
         
            +
                  it('should parse sender_name correctly') do
         
     | 
| 
      
 185 
     | 
    
         
            +
                    @info.sender_name.should_not(be_nil)
         
     | 
| 
       187 
186 
     | 
    
         
             
                    @info.sender_name.should == @original_info.sender_name
         
     | 
| 
       188 
187 
     | 
    
         
             
                  end
         
     | 
| 
       189 
188 
     | 
    
         | 
| 
       190 
     | 
    
         
            -
                  it( 
     | 
| 
       191 
     | 
    
         
            -
                    @info.headline.should_not( 
     | 
| 
      
 189 
     | 
    
         
            +
                  it('should parse headline correctly') do
         
     | 
| 
      
 190 
     | 
    
         
            +
                    @info.headline.should_not(be_nil)
         
     | 
| 
       192 
191 
     | 
    
         
             
                    @info.headline.should == @original_info.headline
         
     | 
| 
       193 
192 
     | 
    
         
             
                  end
         
     | 
| 
       194 
193 
     | 
    
         | 
| 
       195 
     | 
    
         
            -
                  it( 
     | 
| 
       196 
     | 
    
         
            -
                    @info.description.should_not( 
     | 
| 
      
 194 
     | 
    
         
            +
                  it('should parse description correctly') do
         
     | 
| 
      
 195 
     | 
    
         
            +
                    @info.description.should_not(be_nil)
         
     | 
| 
       197 
196 
     | 
    
         
             
                    @info.description.should == @original_info.description
         
     | 
| 
       198 
197 
     | 
    
         
             
                  end
         
     | 
| 
       199 
198 
     | 
    
         | 
| 
       200 
     | 
    
         
            -
                  it( 
     | 
| 
       201 
     | 
    
         
            -
                    @info.instruction.should_not( 
     | 
| 
      
 199 
     | 
    
         
            +
                  it('should parse instruction correctly') do
         
     | 
| 
      
 200 
     | 
    
         
            +
                    @info.instruction.should_not(be_nil)
         
     | 
| 
       202 
201 
     | 
    
         
             
                    @info.instruction.should == @original_info.instruction
         
     | 
| 
       203 
202 
     | 
    
         
             
                  end
         
     | 
| 
       204 
203 
     | 
    
         | 
| 
       205 
     | 
    
         
            -
                  it( 
     | 
| 
       206 
     | 
    
         
            -
                    @info.web.should_not( 
     | 
| 
      
 204 
     | 
    
         
            +
                  it('should parse web correctly') do
         
     | 
| 
      
 205 
     | 
    
         
            +
                    @info.web.should_not(be_nil)
         
     | 
| 
       207 
206 
     | 
    
         
             
                    @info.web.should == @original_info.web
         
     | 
| 
       208 
207 
     | 
    
         
             
                  end
         
     | 
| 
       209 
208 
     | 
    
         | 
| 
       210 
     | 
    
         
            -
                  it( 
     | 
| 
       211 
     | 
    
         
            -
                    @info.contact.should_not( 
     | 
| 
      
 209 
     | 
    
         
            +
                  it('should parse contact correctly') do
         
     | 
| 
      
 210 
     | 
    
         
            +
                    @info.contact.should_not(be_nil)
         
     | 
| 
       212 
211 
     | 
    
         
             
                    @info.contact.should == @original_info.contact
         
     | 
| 
       213 
212 
     | 
    
         
             
                  end
         
     | 
| 
       214 
213 
     | 
    
         | 
| 
       215 
     | 
    
         
            -
                  it( 
     | 
| 
       216 
     | 
    
         
            -
                    @info.event_codes.should_not( 
     | 
| 
      
 214 
     | 
    
         
            +
                  it('should parse event_codes correctly') do
         
     | 
| 
      
 215 
     | 
    
         
            +
                    @info.event_codes.should_not(be_nil)
         
     | 
| 
       217 
216 
     | 
    
         
             
                    @info.event_codes.should == @original_info.event_codes
         
     | 
| 
       218 
217 
     | 
    
         
             
                  end
         
     | 
| 
       219 
218 
     | 
    
         | 
| 
       220 
     | 
    
         
            -
                  it( 
     | 
| 
       221 
     | 
    
         
            -
                    @info.parameters.should_not( 
     | 
| 
      
 219 
     | 
    
         
            +
                  it('should parse parameters correctly') do
         
     | 
| 
      
 220 
     | 
    
         
            +
                    @info.parameters.should_not(be_nil)
         
     | 
| 
       222 
221 
     | 
    
         
             
                    @info.parameters.should == @original_info.parameters
         
     | 
| 
       223 
222 
     | 
    
         
             
                  end
         
     | 
| 
       224 
223 
     | 
    
         | 
| 
       225 
     | 
    
         
            -
                  it( 
     | 
| 
       226 
     | 
    
         
            -
                    @info.resources.should_not( 
     | 
| 
      
 224 
     | 
    
         
            +
                  it('should parse resources correctly') do
         
     | 
| 
      
 225 
     | 
    
         
            +
                    @info.resources.should_not(be_nil)
         
     | 
| 
       227 
226 
     | 
    
         
             
                    comparison_attributes = lambda do |resource|
         
     | 
| 
       228 
227 
     | 
    
         
             
                      [
         
     | 
| 
       229 
228 
     | 
    
         
             
                        resource.resource_desc,
         
     | 
| 
         @@ -231,48 +230,48 @@ describe( RCAP::CAP_1_2::Info ) do 
     | 
|
| 
       231 
230 
     | 
    
         
             
                        resource.uri
         
     | 
| 
       232 
231 
     | 
    
         
             
                      ]
         
     | 
| 
       233 
232 
     | 
    
         
             
                    end
         
     | 
| 
       234 
     | 
    
         
            -
                    @info.resources.map( 
     | 
| 
      
 233 
     | 
    
         
            +
                    @info.resources.map(&comparison_attributes).should == @original_info.resources.map(&comparison_attributes)
         
     | 
| 
       235 
234 
     | 
    
         
             
                  end
         
     | 
| 
       236 
235 
     | 
    
         | 
| 
       237 
     | 
    
         
            -
                  it( 
     | 
| 
       238 
     | 
    
         
            -
                    @info.areas.should_not( 
     | 
| 
      
 236 
     | 
    
         
            +
                  it('should parse areas correctly') do
         
     | 
| 
      
 237 
     | 
    
         
            +
                    @info.areas.should_not(be_nil)
         
     | 
| 
       239 
238 
     | 
    
         
             
                    @info.areas.should == @original_info.areas
         
     | 
| 
       240 
239 
     | 
    
         
             
                  end
         
     | 
| 
       241 
240 
     | 
    
         
             
                end
         
     | 
| 
       242 
241 
     | 
    
         | 
| 
       243 
     | 
    
         
            -
                context( 
     | 
| 
       244 
     | 
    
         
            -
                  before( 
     | 
| 
       245 
     | 
    
         
            -
                    @original_info = RCAP::CAP_1_2::Info.new( 
     | 
| 
      
 242 
     | 
    
         
            +
                context('from XML') do
         
     | 
| 
      
 243 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
      
 244 
     | 
    
         
            +
                    @original_info = RCAP::CAP_1_2::Info.new(&@info_builder)
         
     | 
| 
       246 
245 
     | 
    
         
             
                    @alert = RCAP::CAP_1_2::Alert.new
         
     | 
| 
       247 
     | 
    
         
            -
                    @alert.add_info( 
     | 
| 
      
 246 
     | 
    
         
            +
                    @alert.add_info(&@info_builder)
         
     | 
| 
       248 
247 
     | 
    
         
             
                    @xml_string = @alert.to_xml
         
     | 
| 
       249 
     | 
    
         
            -
                    @xml_document = REXML::Document.new( 
     | 
| 
       250 
     | 
    
         
            -
                    @info = RCAP::CAP_1_2::Info.from_xml_element( 
     | 
| 
      
 248 
     | 
    
         
            +
                    @xml_document = REXML::Document.new(@xml_string)
         
     | 
| 
      
 249 
     | 
    
         
            +
                    @info = RCAP::CAP_1_2::Info.from_xml_element(RCAP.xpath_first(@xml_document.root, RCAP::CAP_1_2::Info::XPATH, RCAP::CAP_1_2::Alert::XMLNS))
         
     | 
| 
       251 
250 
     | 
    
         
             
                  end
         
     | 
| 
       252 
251 
     | 
    
         | 
| 
       253 
     | 
    
         
            -
                  it_should_behave_like( 
     | 
| 
      
 252 
     | 
    
         
            +
                  it_should_behave_like('it can parse into a CAP 1.2 Info object')
         
     | 
| 
       254 
253 
     | 
    
         
             
                end
         
     | 
| 
       255 
254 
     | 
    
         | 
| 
       256 
     | 
    
         
            -
                context( 
     | 
| 
       257 
     | 
    
         
            -
                  before( 
     | 
| 
       258 
     | 
    
         
            -
                    @original_info = RCAP::CAP_1_2::Info.new( 
     | 
| 
       259 
     | 
    
         
            -
                    @info = RCAP::CAP_1_2::Info.from_h( 
     | 
| 
      
 255 
     | 
    
         
            +
                context('from a hash') do
         
     | 
| 
      
 256 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
      
 257 
     | 
    
         
            +
                    @original_info = RCAP::CAP_1_2::Info.new(&@info_builder)
         
     | 
| 
      
 258 
     | 
    
         
            +
                    @info = RCAP::CAP_1_2::Info.from_h(@original_info.to_h)
         
     | 
| 
       260 
259 
     | 
    
         
             
                  end
         
     | 
| 
       261 
     | 
    
         
            -
                  it_should_behave_like( 
     | 
| 
      
 260 
     | 
    
         
            +
                  it_should_behave_like('it can parse into a CAP 1.2 Info object')
         
     | 
| 
       262 
261 
     | 
    
         
             
                end
         
     | 
| 
       263 
262 
     | 
    
         | 
| 
       264 
     | 
    
         
            -
                context( 
     | 
| 
       265 
     | 
    
         
            -
                  before( 
     | 
| 
       266 
     | 
    
         
            -
                    @original_info = RCAP::CAP_1_2::Info.new( 
     | 
| 
       267 
     | 
    
         
            -
                    @info = RCAP::CAP_1_2::Info.from_yaml_data( 
     | 
| 
      
 263 
     | 
    
         
            +
                context('from yaml_data') do
         
     | 
| 
      
 264 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
      
 265 
     | 
    
         
            +
                    @original_info = RCAP::CAP_1_2::Info.new(&@info_builder)
         
     | 
| 
      
 266 
     | 
    
         
            +
                    @info = RCAP::CAP_1_2::Info.from_yaml_data(YAML.load(@original_info.to_yaml))
         
     | 
| 
       268 
267 
     | 
    
         
             
                  end
         
     | 
| 
       269 
268 
     | 
    
         | 
| 
       270 
     | 
    
         
            -
                  it_should_behave_like( 
     | 
| 
      
 269 
     | 
    
         
            +
                  it_should_behave_like('it can parse into a CAP 1.2 Info object')
         
     | 
| 
       271 
270 
     | 
    
         
             
                end
         
     | 
| 
       272 
271 
     | 
    
         
             
              end
         
     | 
| 
       273 
272 
     | 
    
         | 
| 
       274 
     | 
    
         
            -
              context( 
     | 
| 
       275 
     | 
    
         
            -
                before( 
     | 
| 
      
 273 
     | 
    
         
            +
              context('is not valid if it') do
         
     | 
| 
      
 274 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
       276 
275 
     | 
    
         
             
                  @info = RCAP::CAP_1_2::Info.new do |info|
         
     | 
| 
       277 
276 
     | 
    
         
             
                    info.event      = 'Info Event'
         
     | 
| 
       278 
277 
     | 
    
         
             
                    info.categories << RCAP::CAP_1_2::Info::CATEGORY_GEO
         
     | 
| 
         @@ -282,202 +281,201 @@ describe( RCAP::CAP_1_2::Info ) do 
     | 
|
| 
       282 
281 
     | 
    
         
             
                  end
         
     | 
| 
       283 
282 
     | 
    
         | 
| 
       284 
283 
     | 
    
         
             
                  @info.valid?
         
     | 
| 
       285 
     | 
    
         
            -
                  @info.should( 
     | 
| 
      
 284 
     | 
    
         
            +
                  @info.should(be_valid)
         
     | 
| 
       286 
285 
     | 
    
         
             
                end
         
     | 
| 
       287 
286 
     | 
    
         | 
| 
       288 
     | 
    
         
            -
                it( 
     | 
| 
      
 287 
     | 
    
         
            +
                it('does not have an event') do
         
     | 
| 
       289 
288 
     | 
    
         
             
                  @info.event = nil
         
     | 
| 
       290 
     | 
    
         
            -
                  @info.should_not( 
     | 
| 
      
 289 
     | 
    
         
            +
                  @info.should_not(be_valid)
         
     | 
| 
       291 
290 
     | 
    
         
             
                end
         
     | 
| 
       292 
291 
     | 
    
         | 
| 
       293 
     | 
    
         
            -
                it( 
     | 
| 
      
 292 
     | 
    
         
            +
                it('does not have categories') do
         
     | 
| 
       294 
293 
     | 
    
         
             
                  @info.categories.clear
         
     | 
| 
       295 
     | 
    
         
            -
                  @info.should_not( 
     | 
| 
      
 294 
     | 
    
         
            +
                  @info.should_not(be_valid)
         
     | 
| 
       296 
295 
     | 
    
         
             
                end
         
     | 
| 
       297 
296 
     | 
    
         | 
| 
       298 
     | 
    
         
            -
                it( 
     | 
| 
      
 297 
     | 
    
         
            +
                it('does not have an urgency') do
         
     | 
| 
       299 
298 
     | 
    
         
             
                  @info.urgency = nil
         
     | 
| 
       300 
     | 
    
         
            -
                  @info.should_not( 
     | 
| 
      
 299 
     | 
    
         
            +
                  @info.should_not(be_valid)
         
     | 
| 
       301 
300 
     | 
    
         
             
                end
         
     | 
| 
       302 
301 
     | 
    
         | 
| 
       303 
     | 
    
         
            -
                it( 
     | 
| 
      
 302 
     | 
    
         
            +
                it('does not have an severity') do
         
     | 
| 
       304 
303 
     | 
    
         
             
                  @info.severity = nil
         
     | 
| 
       305 
     | 
    
         
            -
                  @info.should_not( 
     | 
| 
      
 304 
     | 
    
         
            +
                  @info.should_not(be_valid)
         
     | 
| 
       306 
305 
     | 
    
         
             
                end
         
     | 
| 
       307 
306 
     | 
    
         | 
| 
       308 
     | 
    
         
            -
                it( 
     | 
| 
      
 307 
     | 
    
         
            +
                it('does not have an certainty') do
         
     | 
| 
       309 
308 
     | 
    
         
             
                  @info.certainty = nil
         
     | 
| 
       310 
     | 
    
         
            -
                  @info.should_not( 
     | 
| 
      
 309 
     | 
    
         
            +
                  @info.should_not(be_valid)
         
     | 
| 
       311 
310 
     | 
    
         
             
                end
         
     | 
| 
       312 
311 
     | 
    
         
             
              end
         
     | 
| 
       313 
312 
     | 
    
         | 
| 
       314 
     | 
    
         
            -
             
     | 
| 
       315 
     | 
    
         
            -
             
     | 
| 
       316 
     | 
    
         
            -
             
     | 
| 
       317 
     | 
    
         
            -
             
     | 
| 
       318 
     | 
    
         
            -
                    @info = RCAP::CAP_1_2::Info.new( &@info_builder )
         
     | 
| 
      
 313 
     | 
    
         
            +
              describe('when exported') do
         
     | 
| 
      
 314 
     | 
    
         
            +
                context('to hash') do
         
     | 
| 
      
 315 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
      
 316 
     | 
    
         
            +
                    @info = RCAP::CAP_1_2::Info.new(&@info_builder)
         
     | 
| 
       319 
317 
     | 
    
         
             
                    @info_hash = @info.to_h
         
     | 
| 
       320 
318 
     | 
    
         
             
                  end
         
     | 
| 
       321 
319 
     | 
    
         | 
| 
       322 
     | 
    
         
            -
                  it( 
     | 
| 
       323 
     | 
    
         
            -
                    @info_hash[ RCAP::CAP_1_2::Info::LANGUAGE_KEY 
     | 
| 
      
 320 
     | 
    
         
            +
                  it('should export the language correctly') do
         
     | 
| 
      
 321 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_2::Info::LANGUAGE_KEY].should == @info.language
         
     | 
| 
       324 
322 
     | 
    
         
             
                  end
         
     | 
| 
       325 
323 
     | 
    
         | 
| 
       326 
     | 
    
         
            -
                  it( 
     | 
| 
       327 
     | 
    
         
            -
                    @info_hash[ RCAP::CAP_1_2::Info::CATEGORIES_KEY 
     | 
| 
      
 324 
     | 
    
         
            +
                  it('should export the categories') do
         
     | 
| 
      
 325 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_2::Info::CATEGORIES_KEY].should == @info.categories
         
     | 
| 
       328 
326 
     | 
    
         
             
                  end
         
     | 
| 
       329 
327 
     | 
    
         | 
| 
       330 
     | 
    
         
            -
                  it( 
     | 
| 
       331 
     | 
    
         
            -
                    @info_hash[ RCAP::CAP_1_2::Info::EVENT_KEY 
     | 
| 
      
 328 
     | 
    
         
            +
                  it('should export the event') do
         
     | 
| 
      
 329 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_2::Info::EVENT_KEY].should == @info.event
         
     | 
| 
       332 
330 
     | 
    
         
             
                  end
         
     | 
| 
       333 
331 
     | 
    
         | 
| 
       334 
     | 
    
         
            -
                  it( 
     | 
| 
       335 
     | 
    
         
            -
                    @info_hash[ RCAP::CAP_1_2::Info::RESPONSE_TYPES_KEY 
     | 
| 
      
 332 
     | 
    
         
            +
                  it('should export the response types') do
         
     | 
| 
      
 333 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_2::Info::RESPONSE_TYPES_KEY].should == @info.response_types
         
     | 
| 
       336 
334 
     | 
    
         
             
                  end
         
     | 
| 
       337 
335 
     | 
    
         | 
| 
       338 
     | 
    
         
            -
                  it( 
     | 
| 
       339 
     | 
    
         
            -
                    @info_hash[ RCAP::CAP_1_2::Info:: URGENCY_KEY 
     | 
| 
      
 336 
     | 
    
         
            +
                  it('should export the urgency') do
         
     | 
| 
      
 337 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_2::Info:: URGENCY_KEY].should == @info.urgency
         
     | 
| 
       340 
338 
     | 
    
         
             
                  end
         
     | 
| 
       341 
339 
     | 
    
         | 
| 
       342 
     | 
    
         
            -
                  it( 
     | 
| 
       343 
     | 
    
         
            -
                    @info_hash[ RCAP::CAP_1_2::Info:: SEVERITY_KEY 
     | 
| 
      
 340 
     | 
    
         
            +
                  it('should export the severity') do
         
     | 
| 
      
 341 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_2::Info:: SEVERITY_KEY].should == @info.severity
         
     | 
| 
       344 
342 
     | 
    
         
             
                  end
         
     | 
| 
       345 
343 
     | 
    
         | 
| 
       346 
     | 
    
         
            -
                  it( 
     | 
| 
       347 
     | 
    
         
            -
                    @info_hash[ RCAP::CAP_1_2::Info:: CERTAINTY_KEY 
     | 
| 
      
 344 
     | 
    
         
            +
                  it('should export the certainty') do
         
     | 
| 
      
 345 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_2::Info:: CERTAINTY_KEY].should == @info.certainty
         
     | 
| 
       348 
346 
     | 
    
         
             
                  end
         
     | 
| 
       349 
347 
     | 
    
         | 
| 
       350 
     | 
    
         
            -
                  it( 
     | 
| 
       351 
     | 
    
         
            -
                    @info_hash[ RCAP::CAP_1_2::Info:: AUDIENCE_KEY 
     | 
| 
      
 348 
     | 
    
         
            +
                  it('should export the audience') do
         
     | 
| 
      
 349 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_2::Info:: AUDIENCE_KEY].should == @info.audience
         
     | 
| 
       352 
350 
     | 
    
         
             
                  end
         
     | 
| 
       353 
351 
     | 
    
         | 
| 
       354 
     | 
    
         
            -
                  it( 
     | 
| 
       355 
     | 
    
         
            -
                    @info_hash[ RCAP::CAP_1_2::Info::EFFECTIVE_KEY 
     | 
| 
      
 352 
     | 
    
         
            +
                  it('should export the effective date') do
         
     | 
| 
      
 353 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_2::Info::EFFECTIVE_KEY].should == @info.effective.to_s_for_cap
         
     | 
| 
       356 
354 
     | 
    
         
             
                  end
         
     | 
| 
       357 
355 
     | 
    
         | 
| 
       358 
     | 
    
         
            -
                  it( 
     | 
| 
       359 
     | 
    
         
            -
                    @info_hash[ RCAP::CAP_1_2::Info::ONSET_KEY 
     | 
| 
      
 356 
     | 
    
         
            +
                  it('should export the onset date') do
         
     | 
| 
      
 357 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_2::Info::ONSET_KEY].should == @info.onset.to_s_for_cap
         
     | 
| 
       360 
358 
     | 
    
         
             
                  end
         
     | 
| 
       361 
359 
     | 
    
         | 
| 
       362 
     | 
    
         
            -
                  it( 
     | 
| 
       363 
     | 
    
         
            -
                    @info_hash[ RCAP::CAP_1_2::Info::EXPIRES_KEY 
     | 
| 
      
 360 
     | 
    
         
            +
                  it('should export the expires date') do
         
     | 
| 
      
 361 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_2::Info::EXPIRES_KEY].should == @info.expires.to_s_for_cap
         
     | 
| 
       364 
362 
     | 
    
         
             
                  end
         
     | 
| 
       365 
363 
     | 
    
         | 
| 
       366 
     | 
    
         
            -
             
     | 
| 
       367 
     | 
    
         
            -
             
     | 
| 
       368 
     | 
    
         
            -
             
     | 
| 
      
 364 
     | 
    
         
            +
                  it('should export the sender name') do
         
     | 
| 
      
 365 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_2::Info::SENDER_NAME_KEY].should == @info.sender_name
         
     | 
| 
      
 366 
     | 
    
         
            +
                  end
         
     | 
| 
       369 
367 
     | 
    
         | 
| 
       370 
     | 
    
         
            -
             
     | 
| 
       371 
     | 
    
         
            -
             
     | 
| 
       372 
     | 
    
         
            -
             
     | 
| 
      
 368 
     | 
    
         
            +
                  it('should export the headline') do
         
     | 
| 
      
 369 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_2::Info::HEADLINE_KEY].should == @info.headline
         
     | 
| 
      
 370 
     | 
    
         
            +
                  end
         
     | 
| 
       373 
371 
     | 
    
         | 
| 
       374 
     | 
    
         
            -
             
     | 
| 
       375 
     | 
    
         
            -
             
     | 
| 
       376 
     | 
    
         
            -
             
     | 
| 
      
 372 
     | 
    
         
            +
                  it('should export the description') do
         
     | 
| 
      
 373 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_2::Info::DESCRIPTION_KEY].should == @info.description
         
     | 
| 
      
 374 
     | 
    
         
            +
                  end
         
     | 
| 
       377 
375 
     | 
    
         | 
| 
       378 
     | 
    
         
            -
             
     | 
| 
       379 
     | 
    
         
            -
             
     | 
| 
       380 
     | 
    
         
            -
             
     | 
| 
      
 376 
     | 
    
         
            +
                  it('should export the instruction') do
         
     | 
| 
      
 377 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_2::Info::INSTRUCTION_KEY].should == @info.instruction
         
     | 
| 
      
 378 
     | 
    
         
            +
                  end
         
     | 
| 
       381 
379 
     | 
    
         | 
| 
       382 
     | 
    
         
            -
             
     | 
| 
       383 
     | 
    
         
            -
             
     | 
| 
       384 
     | 
    
         
            -
             
     | 
| 
      
 380 
     | 
    
         
            +
                  it('should export the web address ') do
         
     | 
| 
      
 381 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_2::Info::WEB_KEY].should == @info.web
         
     | 
| 
      
 382 
     | 
    
         
            +
                  end
         
     | 
| 
       385 
383 
     | 
    
         | 
| 
       386 
     | 
    
         
            -
             
     | 
| 
       387 
     | 
    
         
            -
             
     | 
| 
       388 
     | 
    
         
            -
             
     | 
| 
      
 384 
     | 
    
         
            +
                  it('should export the contact') do
         
     | 
| 
      
 385 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_2::Info::CONTACT_KEY].should == @info.contact
         
     | 
| 
      
 386 
     | 
    
         
            +
                  end
         
     | 
| 
       389 
387 
     | 
    
         | 
| 
       390 
     | 
    
         
            -
             
     | 
| 
       391 
     | 
    
         
            -
             
     | 
| 
       392 
     | 
    
         
            -
             
     | 
| 
      
 388 
     | 
    
         
            +
                  it('should export the event codes') do
         
     | 
| 
      
 389 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_2::Info::EVENT_CODES_KEY].should == @info.event_codes.map { |event_code| event_code.to_h }
         
     | 
| 
      
 390 
     | 
    
         
            +
                  end
         
     | 
| 
       393 
391 
     | 
    
         | 
| 
       394 
     | 
    
         
            -
             
     | 
| 
       395 
     | 
    
         
            -
             
     | 
| 
       396 
     | 
    
         
            -
             
     | 
| 
      
 392 
     | 
    
         
            +
                  it('should export the parameters ') do
         
     | 
| 
      
 393 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_2::Info::PARAMETERS_KEY].should == @info.parameters.map { |parameter| parameter.to_h }
         
     | 
| 
      
 394 
     | 
    
         
            +
                  end
         
     | 
| 
       397 
395 
     | 
    
         | 
| 
       398 
     | 
    
         
            -
             
     | 
| 
       399 
     | 
    
         
            -
             
     | 
| 
       400 
     | 
    
         
            -
             
     | 
| 
      
 396 
     | 
    
         
            +
                  it('should export the resources ') do
         
     | 
| 
      
 397 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_2::Info::RESOURCES_KEY].should == @info.resources.map { |resource| resource.to_h }
         
     | 
| 
      
 398 
     | 
    
         
            +
                  end
         
     | 
| 
       401 
399 
     | 
    
         | 
| 
       402 
     | 
    
         
            -
             
     | 
| 
       403 
     | 
    
         
            -
             
     | 
| 
       404 
     | 
    
         
            -
             
     | 
| 
      
 400 
     | 
    
         
            +
                  it('should export the areas') do
         
     | 
| 
      
 401 
     | 
    
         
            +
                    @info_hash[ RCAP::CAP_1_2::Info::AREAS_KEY].should == @info.areas.map { |area| area.to_h }
         
     | 
| 
      
 402 
     | 
    
         
            +
                  end
         
     | 
| 
       405 
403 
     | 
    
         
             
                end
         
     | 
| 
       406 
404 
     | 
    
         
             
              end
         
     | 
| 
       407 
405 
     | 
    
         | 
| 
       408 
     | 
    
         
            -
              describe( 
     | 
| 
       409 
     | 
    
         
            -
                before( 
     | 
| 
      
 406 
     | 
    
         
            +
              describe('instance methods') do
         
     | 
| 
      
 407 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
       410 
408 
     | 
    
         
             
                  @info = RCAP::CAP_1_2::Info.new
         
     | 
| 
       411 
409 
     | 
    
         
             
                end
         
     | 
| 
       412 
410 
     | 
    
         | 
| 
       413 
     | 
    
         
            -
                describe( 
     | 
| 
       414 
     | 
    
         
            -
                  before( 
     | 
| 
      
 411 
     | 
    
         
            +
                describe('#add_event_code') do
         
     | 
| 
      
 412 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
       415 
413 
     | 
    
         
             
                    @event_code = @info.add_event_code do |event_code|
         
     | 
| 
       416 
414 
     | 
    
         
             
                      event_code.name = 'Event Code'
         
     | 
| 
       417 
415 
     | 
    
         
             
                      event_code.value = '1234'
         
     | 
| 
       418 
416 
     | 
    
         
             
                    end
         
     | 
| 
       419 
417 
     | 
    
         
             
                  end
         
     | 
| 
       420 
418 
     | 
    
         | 
| 
       421 
     | 
    
         
            -
                  it( 
     | 
| 
      
 419 
     | 
    
         
            +
                  it('should return a 1.2 EventCode') do
         
     | 
| 
       422 
420 
     | 
    
         
             
                    @event_code.class.should == RCAP::CAP_1_2::EventCode
         
     | 
| 
       423 
421 
     | 
    
         
             
                    @event_code.name.should == 'Event Code'
         
     | 
| 
       424 
422 
     | 
    
         
             
                    @event_code.value.should == '1234'
         
     | 
| 
       425 
423 
     | 
    
         
             
                  end
         
     | 
| 
       426 
424 
     | 
    
         | 
| 
       427 
     | 
    
         
            -
                  it( 
     | 
| 
      
 425 
     | 
    
         
            +
                  it('should add an EventCode to the event_codes attribute') do
         
     | 
| 
       428 
426 
     | 
    
         
             
                    @info.event_codes.size.should == 1
         
     | 
| 
       429 
427 
     | 
    
         
             
                  end
         
     | 
| 
       430 
428 
     | 
    
         
             
                end
         
     | 
| 
       431 
429 
     | 
    
         | 
| 
       432 
     | 
    
         
            -
                describe( 
     | 
| 
       433 
     | 
    
         
            -
                  before( 
     | 
| 
      
 430 
     | 
    
         
            +
                describe('#add_parameter') do
         
     | 
| 
      
 431 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
       434 
432 
     | 
    
         
             
                    @parameter = @info.add_parameter do |parameter|
         
     | 
| 
       435 
433 
     | 
    
         
             
                      parameter.name = 'Parameter'
         
     | 
| 
       436 
434 
     | 
    
         
             
                      parameter.value = '1234'
         
     | 
| 
       437 
435 
     | 
    
         
             
                    end
         
     | 
| 
       438 
436 
     | 
    
         
             
                  end
         
     | 
| 
       439 
437 
     | 
    
         | 
| 
       440 
     | 
    
         
            -
                  it( 
     | 
| 
      
 438 
     | 
    
         
            +
                  it('should return a 1.2 Parameter') do
         
     | 
| 
       441 
439 
     | 
    
         
             
                    @parameter.class.should == RCAP::CAP_1_2::Parameter
         
     | 
| 
       442 
440 
     | 
    
         
             
                    @parameter.name.should == 'Parameter'
         
     | 
| 
       443 
441 
     | 
    
         
             
                    @parameter.value.should == '1234'
         
     | 
| 
       444 
442 
     | 
    
         
             
                  end
         
     | 
| 
       445 
443 
     | 
    
         | 
| 
       446 
     | 
    
         
            -
                  it( 
     | 
| 
      
 444 
     | 
    
         
            +
                  it('should add a Parameter to the parameters attribute') do
         
     | 
| 
       447 
445 
     | 
    
         
             
                    @info.parameters.size.should == 1
         
     | 
| 
       448 
446 
     | 
    
         
             
                  end
         
     | 
| 
       449 
447 
     | 
    
         
             
                end
         
     | 
| 
       450 
448 
     | 
    
         | 
| 
       451 
     | 
    
         
            -
                describe( 
     | 
| 
       452 
     | 
    
         
            -
                  before( 
     | 
| 
      
 449 
     | 
    
         
            +
                describe('#add_resource') do
         
     | 
| 
      
 450 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
       453 
451 
     | 
    
         
             
                    @resource = @info.add_resource do |resource|
         
     | 
| 
       454 
452 
     | 
    
         
             
                      resource.resource_desc = 'Resource'
         
     | 
| 
       455 
453 
     | 
    
         
             
                    end
         
     | 
| 
       456 
454 
     | 
    
         
             
                  end
         
     | 
| 
       457 
455 
     | 
    
         | 
| 
       458 
     | 
    
         
            -
                  it( 
     | 
| 
      
 456 
     | 
    
         
            +
                  it('should return a 1.2 Resource') do
         
     | 
| 
       459 
457 
     | 
    
         
             
                    @resource.class.should == RCAP::CAP_1_2::Resource
         
     | 
| 
       460 
458 
     | 
    
         
             
                    @resource.resource_desc.should == 'Resource'
         
     | 
| 
       461 
459 
     | 
    
         
             
                  end
         
     | 
| 
       462 
460 
     | 
    
         | 
| 
       463 
     | 
    
         
            -
                  it( 
     | 
| 
      
 461 
     | 
    
         
            +
                  it('should add a Resource to the resources attribute') do
         
     | 
| 
       464 
462 
     | 
    
         
             
                    @info.resources.size.should == 1
         
     | 
| 
       465 
463 
     | 
    
         
             
                  end
         
     | 
| 
       466 
464 
     | 
    
         
             
                end
         
     | 
| 
       467 
465 
     | 
    
         | 
| 
       468 
     | 
    
         
            -
                describe( 
     | 
| 
       469 
     | 
    
         
            -
                  before( 
     | 
| 
      
 466 
     | 
    
         
            +
                describe('#add_area') do
         
     | 
| 
      
 467 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
       470 
468 
     | 
    
         
             
                    @area = @info.add_area do |area|
         
     | 
| 
       471 
469 
     | 
    
         
             
                      area.area_desc = 'Area'
         
     | 
| 
       472 
470 
     | 
    
         
             
                    end
         
     | 
| 
       473 
471 
     | 
    
         
             
                  end
         
     | 
| 
       474 
472 
     | 
    
         | 
| 
       475 
     | 
    
         
            -
                  it( 
     | 
| 
      
 473 
     | 
    
         
            +
                  it('should return a 1.2 area') do
         
     | 
| 
       476 
474 
     | 
    
         
             
                    @area.class.should == RCAP::CAP_1_2::Area
         
     | 
| 
       477 
475 
     | 
    
         
             
                    @area.area_desc.should == 'Area'
         
     | 
| 
       478 
476 
     | 
    
         
             
                  end
         
     | 
| 
       479 
477 
     | 
    
         | 
| 
       480 
     | 
    
         
            -
                  it( 
     | 
| 
      
 478 
     | 
    
         
            +
                  it('should add a Area to the areas attribute') do
         
     | 
| 
       481 
479 
     | 
    
         
             
                    @info.areas.size.should == 1
         
     | 
| 
       482 
480 
     | 
    
         
             
                  end
         
     | 
| 
       483 
481 
     | 
    
         
             
                end
         
     |