rcap 2.7.3 → 2.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +4 -0
- data/lib/rcap/base/alert.rb +13 -19
- data/lib/rcap/base/info.rb +16 -16
- data/lib/rcap/base/parameter.rb +2 -2
- data/lib/rcap/base/resource.rb +4 -4
- data/lib/rcap/cap_1_0/alert.rb +14 -20
- data/lib/rcap/cap_1_1/info.rb +14 -14
- data/lib/rcap/cap_1_1/resource.rb +6 -6
- data/lib/rcap/cap_1_2/info.rb +13 -13
- data/lib/rcap/cap_1_2/resource.rb +6 -6
- data/lib/rcap/custom_validators.rb +18 -16
- data/lib/rcap/utilities.rb +1 -1
- data/lib/rcap/validation.rb +8 -5
- data/lib/rcap/version.rb +1 -1
- data/spec/alert_spec.rb +8 -9
- data/spec/cap_1_0/alert_spec.rb +4 -5
- data/spec/cap_1_0/area_spec.rb +7 -10
- data/spec/cap_1_0/event_code_spec.rb +1 -1
- data/spec/cap_1_0/geocode_spec.rb +1 -1
- data/spec/cap_1_0/info_spec.rb +38 -38
- data/spec/cap_1_0/resource_spec.rb +6 -7
- data/spec/cap_1_1/alert_spec.rb +6 -7
- data/spec/cap_1_1/area_spec.rb +6 -8
- data/spec/cap_1_1/info_spec.rb +26 -26
- data/spec/cap_1_1/parameter_spec.rb +1 -2
- data/spec/cap_1_1/resource_spec.rb +12 -12
- data/spec/cap_1_2/alert_spec.rb +7 -8
- data/spec/cap_1_2/area_spec.rb +6 -6
- data/spec/cap_1_2/info_spec.rb +25 -26
- data/spec/cap_1_2/resource_spec.rb +12 -12
- data/spec/extensions_spec.rb +2 -2
- data/spec/spec_helper.rb +2 -2
- data/spec/validations_spec.rb +0 -1
- metadata +6 -7
data/lib/rcap/version.rb
CHANGED
data/spec/alert_spec.rb
CHANGED
@@ -2,7 +2,6 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe(RCAP::Alert) do
|
4
4
|
describe('initialising') do
|
5
|
-
|
6
5
|
context('a CAP 1.0 alert') do
|
7
6
|
before(:each) do
|
8
7
|
@original_alert = RCAP::CAP_1_0::Alert.new do |alert|
|
@@ -15,14 +14,14 @@ describe(RCAP::Alert) do
|
|
15
14
|
['Address 1', 'Address 2'].each do |address|
|
16
15
|
alert.addresses << address
|
17
16
|
end
|
18
|
-
%w
|
17
|
+
%w[Code1 Code2].each do |code|
|
19
18
|
alert.codes << code
|
20
19
|
end
|
21
20
|
alert.note = 'Note'
|
22
21
|
['1.0,1', '1.0,2'].each do |reference|
|
23
22
|
alert.references << reference
|
24
23
|
end
|
25
|
-
%w
|
24
|
+
%w[Incident1 Incident2].each do |incident|
|
26
25
|
alert.incidents << incident
|
27
26
|
end
|
28
27
|
2.times { alert.add_info }
|
@@ -87,14 +86,14 @@ describe(RCAP::Alert) do
|
|
87
86
|
['Address 1', 'Address 2'].each do |address|
|
88
87
|
alert.addresses << address
|
89
88
|
end
|
90
|
-
%w
|
89
|
+
%w[Code1 Code2].each do |code|
|
91
90
|
alert.codes << code
|
92
91
|
end
|
93
92
|
alert.note = 'Note'
|
94
93
|
['1,1,1', '1,1,2'].each do |reference|
|
95
94
|
alert.references << reference
|
96
95
|
end
|
97
|
-
%w
|
96
|
+
%w[Incident1 Incident2].each do |incident|
|
98
97
|
alert.incidents << incident
|
99
98
|
end
|
100
99
|
2.times { alert.add_info }
|
@@ -102,7 +101,7 @@ describe(RCAP::Alert) do
|
|
102
101
|
end
|
103
102
|
|
104
103
|
shared_examples_for('it has parsed a CAP 1.1 alert correctly') do
|
105
|
-
it('should use the correct CAP Version') { @alert.class.should
|
104
|
+
it('should use the correct CAP Version') { @alert.class.should == RCAP::CAP_1_1::Alert }
|
106
105
|
it('should parse identifier correctly') { @alert.identifier.should == @original_alert.identifier }
|
107
106
|
it('should parse sender correctly') { @alert.sender.should == @original_alert.sender }
|
108
107
|
it('should parse sent correctly') { @alert.sent.should(be_within(1).of(@original_alert.sent)) }
|
@@ -159,14 +158,14 @@ describe(RCAP::Alert) do
|
|
159
158
|
['Address 1', 'Address 2'].each do |address|
|
160
159
|
alert.addresses << address
|
161
160
|
end
|
162
|
-
%w
|
161
|
+
%w[Code1 Code2].each do |code|
|
163
162
|
alert.codes << code
|
164
163
|
end
|
165
164
|
alert.note = 'Note'
|
166
165
|
['1,1,1', '1,1,2'].each do |reference|
|
167
166
|
alert.references << reference
|
168
167
|
end
|
169
|
-
%w
|
168
|
+
%w[Incident1 Incident2].each do |incident|
|
170
169
|
alert.incidents << incident
|
171
170
|
end
|
172
171
|
2.times { alert.add_info }
|
@@ -174,7 +173,7 @@ describe(RCAP::Alert) do
|
|
174
173
|
end
|
175
174
|
|
176
175
|
shared_examples_for('it has parsed a CAP 1.2 alert correctly') do
|
177
|
-
it('should use the correct CAP Version') { @alert.class.should
|
176
|
+
it('should use the correct CAP Version') { @alert.class.should == RCAP::CAP_1_2::Alert }
|
178
177
|
it('should parse identifier correctly') { @alert.identifier.should == @original_alert.identifier }
|
179
178
|
it('should parse sender correctly') { @alert.sender.should == @original_alert.sender }
|
180
179
|
it('should parse sent correctly') { @alert.sent.should(be_within(1).of(@original_alert.sent)) }
|
data/spec/cap_1_0/alert_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe(RCAP::CAP_1_0::Alert) do
|
4
4
|
context('on initialisation') do
|
5
|
-
before(:each)
|
5
|
+
before(:each) do
|
6
6
|
@alert = RCAP::CAP_1_0::Alert.new
|
7
7
|
|
8
8
|
@original_alert = RCAP::CAP_1_0::Alert.new do |alert|
|
@@ -15,17 +15,17 @@ describe(RCAP::CAP_1_0::Alert) do
|
|
15
15
|
['Address 1', 'Address 2'].each do |address|
|
16
16
|
alert.addresses << address
|
17
17
|
end
|
18
|
-
%w
|
18
|
+
%w[Code1 Code2].each do |code|
|
19
19
|
alert.codes << code
|
20
20
|
end
|
21
21
|
alert.note = 'Note'
|
22
|
-
%w
|
22
|
+
%w[Sender1 Sender2].each do |sender|
|
23
23
|
a = RCAP::CAP_1_0::Alert.new do |a|
|
24
24
|
a.sender = sender
|
25
25
|
end
|
26
26
|
alert.references << a.to_reference
|
27
27
|
end
|
28
|
-
%w
|
28
|
+
%w[Incident1 Incident2].each do |incident|
|
29
29
|
alert.incidents << incident
|
30
30
|
end
|
31
31
|
2.times { alert.add_info }
|
@@ -75,7 +75,6 @@ describe(RCAP::CAP_1_0::Alert) do
|
|
75
75
|
end
|
76
76
|
|
77
77
|
it_should_behave_like('a successfully parsed CAP 1.0 alert')
|
78
|
-
|
79
78
|
end
|
80
79
|
|
81
80
|
context('from YAML') do
|
data/spec/cap_1_0/area_spec.rb
CHANGED
@@ -66,9 +66,8 @@ describe(RCAP::CAP_1_0::Area) do
|
|
66
66
|
|
67
67
|
context('from XML') do
|
68
68
|
before(:each) do
|
69
|
-
|
70
69
|
@alert = RCAP::CAP_1_0::Alert.new
|
71
|
-
@alert.add_info.areas <<
|
70
|
+
@alert.add_info.areas << @original_area
|
72
71
|
@xml_string = @alert.to_xml
|
73
72
|
@xml_document = REXML::Document.new(@xml_string)
|
74
73
|
@info_xml_element = RCAP.xpath_first(@xml_document.root, RCAP::CAP_1_0::Info::XPATH, RCAP::CAP_1_0::Alert::XMLNS)
|
@@ -81,7 +80,6 @@ describe(RCAP::CAP_1_0::Area) do
|
|
81
80
|
|
82
81
|
context('from YAML Data') do
|
83
82
|
before(:each) do
|
84
|
-
|
85
83
|
@area = RCAP::CAP_1_0::Area.from_yaml_data(YAML.load(@original_area.to_yaml))
|
86
84
|
end
|
87
85
|
|
@@ -90,7 +88,6 @@ describe(RCAP::CAP_1_0::Area) do
|
|
90
88
|
|
91
89
|
context('from a hash') do
|
92
90
|
before(:each) do
|
93
|
-
|
94
91
|
@area = RCAP::CAP_1_0::Area.from_h(@original_area.to_h)
|
95
92
|
end
|
96
93
|
|
@@ -129,27 +126,27 @@ describe(RCAP::CAP_1_0::Area) do
|
|
129
126
|
end
|
130
127
|
|
131
128
|
it('should export the area description correctly') do
|
132
|
-
@area_hash[
|
129
|
+
@area_hash[RCAP::CAP_1_0::Area::AREA_DESC_KEY].should == @area.area_desc
|
133
130
|
end
|
134
131
|
|
135
132
|
it('should export the altitude correctly') do
|
136
|
-
@area_hash[
|
133
|
+
@area_hash[RCAP::CAP_1_0::Area::ALTITUDE_KEY].should == @area.altitude
|
137
134
|
end
|
138
135
|
|
139
136
|
it('should set the ceiling correctly') do
|
140
|
-
@area_hash[
|
137
|
+
@area_hash[RCAP::CAP_1_0::Area::CEILING_KEY].should == @area.ceiling
|
141
138
|
end
|
142
139
|
|
143
140
|
it('should export the circles correctly') do
|
144
|
-
@area_hash[
|
141
|
+
@area_hash[RCAP::CAP_1_0::Area::CIRCLES_KEY].should == @area.circles.map { |circle| circle.to_a }
|
145
142
|
end
|
146
143
|
|
147
144
|
it('should export the geocodes correctly') do
|
148
|
-
@area_hash[
|
145
|
+
@area_hash[RCAP::CAP_1_0::Area::GEOCODES_KEY].should == @area.geocodes.map { |geocode| geocode.to_h }
|
149
146
|
end
|
150
147
|
|
151
148
|
it('should export the polygons correctly') do
|
152
|
-
@area_hash[
|
149
|
+
@area_hash[RCAP::CAP_1_0::Area::POLYGONS_KEY].should == @area.polygons.map { |polygon| polygon.to_h }
|
153
150
|
end
|
154
151
|
end
|
155
152
|
end
|
@@ -9,7 +9,7 @@ describe(RCAP::CAP_1_0::EventCode) do
|
|
9
9
|
event_code.value = 'value'
|
10
10
|
end
|
11
11
|
@alert = RCAP::CAP_1_0::Alert.new
|
12
|
-
@alert.add_info.event_codes <<
|
12
|
+
@alert.add_info.event_codes << @original_event_code
|
13
13
|
@xml_string = @alert.to_xml
|
14
14
|
@xml_document = REXML::Document.new(@xml_string)
|
15
15
|
@info_xml_element = RCAP.xpath_first(@xml_document.root, RCAP::CAP_1_0::Info::XPATH, RCAP::CAP_1_0::Alert::XMLNS)
|
@@ -9,7 +9,7 @@ describe(RCAP::CAP_1_0::Geocode) do
|
|
9
9
|
geocode.value = 'value'
|
10
10
|
end
|
11
11
|
@alert = RCAP::CAP_1_0::Alert.new
|
12
|
-
@alert.add_info.add_area.geocodes <<
|
12
|
+
@alert.add_info.add_area.geocodes << @original_geocode
|
13
13
|
@xml_string = @alert.to_xml
|
14
14
|
@xml_document = REXML::Document.new(@xml_string)
|
15
15
|
@info_xml_element = RCAP.xpath_first(@xml_document.root, RCAP::CAP_1_0::Info::XPATH, RCAP::CAP_1_0::Alert::XMLNS)
|
data/spec/cap_1_0/info_spec.rb
CHANGED
@@ -26,21 +26,21 @@ describe(RCAP::CAP_1_0::Info) do
|
|
26
26
|
resource.uri = 'http://tempuri.org/resource'
|
27
27
|
end
|
28
28
|
|
29
|
-
[%w
|
29
|
+
[%w[name1 value1], %w[name2 value2]].each do |name, value|
|
30
30
|
info.add_event_code do |event_code|
|
31
31
|
event_code.name = name
|
32
32
|
event_code.value = value
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
[%w
|
36
|
+
[%w[name1 value1], %w[name2 value2]].each do |name, value|
|
37
37
|
info.add_parameter do |parameter|
|
38
38
|
parameter.name = name
|
39
39
|
parameter.value = value
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
%w
|
43
|
+
%w[Area1 Area2].each do |area_desc|
|
44
44
|
info.add_area do |area|
|
45
45
|
area.area_desc = area_desc
|
46
46
|
end
|
@@ -72,25 +72,25 @@ describe(RCAP::CAP_1_0::Info) do
|
|
72
72
|
it('should have no parameters') { @info.parameters.should(be_empty) }
|
73
73
|
|
74
74
|
shared_examples_for('it can parse into a CAP 1.0 Info object') do
|
75
|
-
it('should parse categories correctly') { @info.categories.should_not(be_nil); @info.categories.should
|
76
|
-
it('should parse event correctly') { @info.event.should_not(be_nil); @info.event.should
|
77
|
-
it('should parse urgency correctly') { @info.urgency.should_not(be_nil); @info.urgency.should
|
78
|
-
it('should parse severity correctly') { @info.severity.should_not(be_nil); @info.severity.should
|
79
|
-
it('should parse certainty correctly') { @info.certainty.should_not(be_nil); @info.certainty.should
|
80
|
-
it('should parse audience correctly') { @info.audience.should_not(be_nil); @info.audience.should
|
75
|
+
it('should parse categories correctly') { @info.categories.should_not(be_nil); @info.categories.should == @original_info.categories }
|
76
|
+
it('should parse event correctly') { @info.event.should_not(be_nil); @info.event.should == @original_info.event }
|
77
|
+
it('should parse urgency correctly') { @info.urgency.should_not(be_nil); @info.urgency.should == @original_info.urgency }
|
78
|
+
it('should parse severity correctly') { @info.severity.should_not(be_nil); @info.severity.should == @original_info.severity }
|
79
|
+
it('should parse certainty correctly') { @info.certainty.should_not(be_nil); @info.certainty.should == @original_info.certainty }
|
80
|
+
it('should parse audience correctly') { @info.audience.should_not(be_nil); @info.audience.should == @original_info.audience }
|
81
81
|
it('should parse effective correctly') { @info.effective.should_not(be_nil); @info.effective.should(be_within(Rational(1, 86_400)).of(@original_info.effective)) }
|
82
82
|
it('should parse onset correctly') { @info.onset.should_not(be_nil); @info.onset.should(be_within(Rational(1, 86_400)).of(@original_info.onset)) }
|
83
83
|
it('should parse expires correctly') { @info.expires.should_not(be_nil); @info.expires.should(be_within(Rational(1, 86_400)).of(@original_info.expires)) }
|
84
|
-
it('should parse sender_name correctly') { @info.sender_name.should_not(be_nil); @info.sender_name.should
|
85
|
-
it('should parse headline correctly') { @info.headline.should_not(be_nil); @info.headline.should
|
84
|
+
it('should parse sender_name correctly') { @info.sender_name.should_not(be_nil); @info.sender_name.should == @original_info.sender_name }
|
85
|
+
it('should parse headline correctly') { @info.headline.should_not(be_nil); @info.headline.should == @original_info.headline }
|
86
86
|
it('should parse description correctly') { @info.description.should_not(be_nil); @info.description.should == @original_info.description }
|
87
87
|
it('should parse instruction correctly') { @info.instruction.should_not(be_nil); @info.instruction.should == @original_info.instruction }
|
88
|
-
it('should parse web correctly') { @info.web.should_not(be_nil); @info.web.should
|
89
|
-
it('should parse contact correctly') { @info.contact.should_not(be_nil); @info.contact.should
|
90
|
-
it('should parse event_codes correctly') { @info.event_codes.should_not(be_nil); @info.event_codes.should
|
91
|
-
it('should parse parameters correctly') { @info.parameters.should_not(be_nil); @info.parameters.should
|
92
|
-
it('should parse resources correctly') { @info.resources.should_not(be_nil); @info.resources.map(&:to_s).should
|
93
|
-
it('should parse areas correctly') { @info.areas.should_not(be_nil); @info.areas.should
|
88
|
+
it('should parse web correctly') { @info.web.should_not(be_nil); @info.web.should == @original_info.web }
|
89
|
+
it('should parse contact correctly') { @info.contact.should_not(be_nil); @info.contact.should == @original_info.contact }
|
90
|
+
it('should parse event_codes correctly') { @info.event_codes.should_not(be_nil); @info.event_codes.should == @original_info.event_codes }
|
91
|
+
it('should parse parameters correctly') { @info.parameters.should_not(be_nil); @info.parameters.should == @original_info.parameters }
|
92
|
+
it('should parse resources correctly') { @info.resources.should_not(be_nil); @info.resources.map(&:to_s).should == @original_info.resources.map(&:to_s) }
|
93
|
+
it('should parse areas correctly') { @info.areas.should_not(be_nil); @info.areas.should == @original_info.areas }
|
94
94
|
end
|
95
95
|
|
96
96
|
context('from XML') do
|
@@ -119,7 +119,7 @@ describe(RCAP::CAP_1_0::Info) do
|
|
119
119
|
before(:each) do
|
120
120
|
@info = RCAP::CAP_1_0::Info.new do |info|
|
121
121
|
info.event = 'Info Event'
|
122
|
-
info.categories <<
|
122
|
+
info.categories << RCAP::CAP_1_0::Info::CATEGORY_GEO
|
123
123
|
info.urgency = RCAP::CAP_1_0::Info::URGENCY_IMMEDIATE
|
124
124
|
info.severity = RCAP::CAP_1_0::Info::SEVERITY_EXTREME
|
125
125
|
info.certainty = RCAP::CAP_1_0::Info::CERTAINTY_VERY_LIKELY
|
@@ -158,83 +158,83 @@ describe(RCAP::CAP_1_0::Info) do
|
|
158
158
|
end
|
159
159
|
|
160
160
|
it('should export the language correctly') do
|
161
|
-
@info_hash[
|
161
|
+
@info_hash[RCAP::CAP_1_0::Info::LANGUAGE_KEY].should == @info.language
|
162
162
|
end
|
163
163
|
|
164
164
|
it('should export the categories') do
|
165
|
-
@info_hash[
|
165
|
+
@info_hash[RCAP::CAP_1_0::Info::CATEGORIES_KEY].should == @info.categories
|
166
166
|
end
|
167
167
|
|
168
168
|
it('should export the event') do
|
169
|
-
@info_hash[
|
169
|
+
@info_hash[RCAP::CAP_1_0::Info::EVENT_KEY].should == @info.event
|
170
170
|
end
|
171
171
|
|
172
172
|
it('should export the urgency') do
|
173
|
-
@info_hash[
|
173
|
+
@info_hash[RCAP::CAP_1_0::Info:: URGENCY_KEY].should == @info.urgency
|
174
174
|
end
|
175
175
|
|
176
176
|
it('should export the severity') do
|
177
|
-
@info_hash[
|
177
|
+
@info_hash[RCAP::CAP_1_0::Info:: SEVERITY_KEY].should == @info.severity
|
178
178
|
end
|
179
179
|
|
180
180
|
it('should export the certainty') do
|
181
|
-
@info_hash[
|
181
|
+
@info_hash[RCAP::CAP_1_0::Info:: CERTAINTY_KEY].should == @info.certainty
|
182
182
|
end
|
183
183
|
|
184
184
|
it('should export the audience') do
|
185
|
-
@info_hash[
|
185
|
+
@info_hash[RCAP::CAP_1_0::Info:: AUDIENCE_KEY].should == @info.audience
|
186
186
|
end
|
187
187
|
|
188
188
|
it('should export the effective date') do
|
189
|
-
@info_hash[
|
189
|
+
@info_hash[RCAP::CAP_1_0::Info::EFFECTIVE_KEY].should == @info.effective.to_s_for_cap
|
190
190
|
end
|
191
191
|
|
192
192
|
it('should export the onset date') do
|
193
|
-
@info_hash[
|
193
|
+
@info_hash[RCAP::CAP_1_0::Info::ONSET_KEY].should == @info.onset.to_s_for_cap
|
194
194
|
end
|
195
195
|
|
196
196
|
it('should export the expires date') do
|
197
|
-
@info_hash[
|
197
|
+
@info_hash[RCAP::CAP_1_0::Info::EXPIRES_KEY].should == @info.expires.to_s_for_cap
|
198
198
|
end
|
199
199
|
|
200
200
|
it('should export the sender name') do
|
201
|
-
@info_hash[
|
201
|
+
@info_hash[RCAP::CAP_1_0::Info::SENDER_NAME_KEY].should == @info.sender_name
|
202
202
|
end
|
203
203
|
|
204
204
|
it('should export the headline') do
|
205
|
-
@info_hash[
|
205
|
+
@info_hash[RCAP::CAP_1_0::Info::HEADLINE_KEY].should == @info.headline
|
206
206
|
end
|
207
207
|
|
208
208
|
it('should export the description') do
|
209
|
-
@info_hash[
|
209
|
+
@info_hash[RCAP::CAP_1_0::Info::DESCRIPTION_KEY].should == @info.description
|
210
210
|
end
|
211
211
|
|
212
212
|
it('should export the instruction') do
|
213
|
-
@info_hash[
|
213
|
+
@info_hash[RCAP::CAP_1_0::Info::INSTRUCTION_KEY].should == @info.instruction
|
214
214
|
end
|
215
215
|
|
216
216
|
it('should export the web address ') do
|
217
|
-
@info_hash[
|
217
|
+
@info_hash[RCAP::CAP_1_0::Info::WEB_KEY].should == @info.web
|
218
218
|
end
|
219
219
|
|
220
220
|
it('should export the contact') do
|
221
|
-
@info_hash[
|
221
|
+
@info_hash[RCAP::CAP_1_0::Info::CONTACT_KEY].should == @info.contact
|
222
222
|
end
|
223
223
|
|
224
224
|
it('should export the event codes') do
|
225
|
-
@info_hash[
|
225
|
+
@info_hash[RCAP::CAP_1_0::Info::EVENT_CODES_KEY].should == @info.event_codes.map { |event_code| event_code.to_h }
|
226
226
|
end
|
227
227
|
|
228
228
|
it('should export the parameters ') do
|
229
|
-
@info_hash[
|
229
|
+
@info_hash[RCAP::CAP_1_0::Info::PARAMETERS_KEY].should == @info.parameters.map { |parameter| parameter.to_h }
|
230
230
|
end
|
231
231
|
|
232
232
|
it('should export the resources ') do
|
233
|
-
@info_hash[
|
233
|
+
@info_hash[RCAP::CAP_1_0::Info::RESOURCES_KEY].should == @info.resources.map { |resource| resource.to_h }
|
234
234
|
end
|
235
235
|
|
236
236
|
it('should export the areas') do
|
237
|
-
@info_hash[
|
237
|
+
@info_hash[RCAP::CAP_1_0::Info::AREAS_KEY].should == @info.areas.map { |area| area.to_h }
|
238
238
|
end
|
239
239
|
end
|
240
240
|
end
|
@@ -86,7 +86,6 @@ describe(RCAP::CAP_1_0::Resource) do
|
|
86
86
|
@resource.digest.should == @original_resource.digest
|
87
87
|
end
|
88
88
|
end
|
89
|
-
|
90
89
|
end
|
91
90
|
|
92
91
|
context('when exported') do
|
@@ -106,29 +105,29 @@ describe(RCAP::CAP_1_0::Resource) do
|
|
106
105
|
end
|
107
106
|
|
108
107
|
it('should set the resource description') do
|
109
|
-
@resource_hash[
|
108
|
+
@resource_hash[RCAP::CAP_1_0::Resource::RESOURCE_DESC_KEY].should == @resource.resource_desc
|
110
109
|
end
|
111
110
|
|
112
111
|
it('should set the mime type') do
|
113
|
-
@resource_hash[
|
112
|
+
@resource_hash[RCAP::CAP_1_0::Resource::MIME_TYPE_KEY].should == @resource.mime_type
|
114
113
|
end
|
115
114
|
|
116
115
|
it('should set the size') do
|
117
|
-
@resource_hash[
|
116
|
+
@resource_hash[RCAP::CAP_1_0::Resource::SIZE_KEY].should == @resource.size
|
118
117
|
end
|
119
118
|
|
120
119
|
it('should set the URI') do
|
121
|
-
@resource_hash[
|
120
|
+
@resource_hash[RCAP::CAP_1_0::Resource::URI_KEY].should == @resource.uri
|
122
121
|
end
|
123
122
|
|
124
123
|
it('should set the digest') do
|
125
|
-
@resource_hash[
|
124
|
+
@resource_hash[RCAP::CAP_1_0::Resource::DIGEST_KEY].should == @resource.digest
|
126
125
|
end
|
127
126
|
end
|
128
127
|
|
129
128
|
context('to xml') do
|
130
129
|
it('should be successful') do
|
131
|
-
|
130
|
+
-> { @resource_xml = @resource.to_xml }.should_not(raise_exception)
|
132
131
|
end
|
133
132
|
end
|
134
133
|
end
|
data/spec/cap_1_1/alert_spec.rb
CHANGED
@@ -12,14 +12,14 @@ describe(RCAP::CAP_1_1::Alert) do
|
|
12
12
|
['Address 1', 'Address 2'].each do |address|
|
13
13
|
alert.addresses << address
|
14
14
|
end
|
15
|
-
%w
|
15
|
+
%w[Code1 Code2].each do |code|
|
16
16
|
alert.codes << code
|
17
17
|
end
|
18
|
-
alert.note
|
19
|
-
%w
|
18
|
+
alert.note = 'Note'
|
19
|
+
%w[Reference1 Reference2].each do |reference|
|
20
20
|
alert.references << reference
|
21
21
|
end
|
22
|
-
%w
|
22
|
+
%w[Incident1 Incident2].each do |_incident|
|
23
23
|
end
|
24
24
|
alert.add_info
|
25
25
|
alert.add_info
|
@@ -27,7 +27,7 @@ describe(RCAP::CAP_1_1::Alert) do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
context('on initialisation') do
|
30
|
-
before(:each)
|
30
|
+
before(:each) do
|
31
31
|
@alert = RCAP::CAP_1_1::Alert.new
|
32
32
|
end
|
33
33
|
|
@@ -75,7 +75,6 @@ describe(RCAP::CAP_1_1::Alert) do
|
|
75
75
|
end
|
76
76
|
|
77
77
|
it_should_behave_like('a successfully parsed CAP 1.1 alert')
|
78
|
-
|
79
78
|
end
|
80
79
|
|
81
80
|
context('from YAML') do
|
@@ -168,7 +167,7 @@ describe(RCAP::CAP_1_1::Alert) do
|
|
168
167
|
context('has an info element and it') do
|
169
168
|
it('is not valid') do
|
170
169
|
@info = @alert.add_info do |info|
|
171
|
-
info.event
|
170
|
+
info.event = 'Info Event'
|
172
171
|
info.categories << RCAP::CAP_1_1::Info::CATEGORY_GEO
|
173
172
|
info.urgency = RCAP::CAP_1_1::Info::URGENCY_IMMEDIATE
|
174
173
|
info.severity = RCAP::CAP_1_1::Info::SEVERITY_EXTREME
|