aixm 0.3.3 → 0.3.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.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +1 -2
  4. data/CHANGELOG.md +20 -0
  5. data/README.md +7 -2
  6. data/aixm.gemspec +2 -3
  7. data/lib/aixm.rb +6 -2
  8. data/lib/aixm/a.rb +151 -0
  9. data/lib/aixm/component/frequency.rb +2 -2
  10. data/lib/aixm/component/geometry.rb +4 -0
  11. data/lib/aixm/component/geometry/point.rb +0 -4
  12. data/lib/aixm/component/helipad.rb +8 -22
  13. data/lib/aixm/component/runway.rb +36 -36
  14. data/lib/aixm/component/surface.rb +121 -0
  15. data/lib/aixm/component/timetable.rb +1 -0
  16. data/lib/aixm/constants.rb +40 -0
  17. data/lib/aixm/d.rb +5 -0
  18. data/lib/aixm/document.rb +2 -2
  19. data/lib/aixm/f.rb +6 -0
  20. data/lib/aixm/feature/address.rb +100 -0
  21. data/lib/aixm/feature/airport.rb +26 -7
  22. data/lib/aixm/feature/airspace.rb +10 -1
  23. data/lib/aixm/feature/navigational_aid.rb +1 -1
  24. data/lib/aixm/feature/navigational_aid/designated_point.rb +20 -5
  25. data/lib/aixm/feature/navigational_aid/dme.rb +2 -2
  26. data/lib/aixm/{component → feature}/service.rb +67 -16
  27. data/lib/aixm/feature/unit.rb +40 -6
  28. data/lib/aixm/refinements.rb +63 -6
  29. data/lib/aixm/shortcuts.rb +12 -4
  30. data/lib/aixm/version.rb +1 -1
  31. data/lib/aixm/xy.rb +6 -1
  32. data/lib/aixm/z.rb +6 -0
  33. data/schemas/ofmx/0/OFMX-DataTypes.xsd +5 -2
  34. data/schemas/ofmx/0/OFMX-Features.xsd +2 -0
  35. data/spec/factory.rb +32 -10
  36. data/spec/lib/aixm/a_spec.rb +203 -0
  37. data/spec/lib/aixm/component/helipad_spec.rb +11 -17
  38. data/spec/lib/aixm/component/runway_spec.rb +46 -32
  39. data/spec/lib/aixm/component/surface_spec.rb +88 -0
  40. data/spec/lib/aixm/d_spec.rb +10 -0
  41. data/spec/lib/aixm/document_spec.rb +104 -32
  42. data/spec/lib/aixm/f_spec.rb +10 -0
  43. data/spec/lib/aixm/feature/address_spec.rb +55 -0
  44. data/spec/lib/aixm/feature/airport_spec.rb +73 -3
  45. data/spec/lib/aixm/feature/navigational_aid/designated_point_spec.rb +43 -6
  46. data/spec/lib/aixm/feature/navigational_aid/dme_spec.rb +2 -2
  47. data/spec/lib/aixm/feature/navigational_aid/marker_spec.rb +2 -2
  48. data/spec/lib/aixm/feature/navigational_aid/ndb_spec.rb +2 -2
  49. data/spec/lib/aixm/feature/navigational_aid/tacan_spec.rb +2 -2
  50. data/spec/lib/aixm/feature/navigational_aid/vor_spec.rb +6 -6
  51. data/spec/lib/aixm/{component → feature}/service_spec.rb +12 -14
  52. data/spec/lib/aixm/feature/unit_spec.rb +7 -4
  53. data/spec/lib/aixm/refinements_spec.rb +100 -15
  54. data/spec/lib/aixm/z_spec.rb +10 -0
  55. metadata +17 -25
  56. data/lib/aixm/h.rb +0 -87
  57. data/spec/lib/aixm/h_spec.rb +0 -113
@@ -72,4 +72,14 @@ describe AIXM::F do
72
72
  { subject => true }[dupe].must_equal true
73
73
  end
74
74
  end
75
+
76
+ describe :zero? do
77
+ it "returns true for zero frequency" do
78
+ subject.tap { |s| s.freq = 0 }.must_be :zero?
79
+ end
80
+
81
+ it "returns false for non-zero frequency" do
82
+ subject.tap { |s| s.freq = 1 }.wont_be :zero?
83
+ end
84
+ end
75
85
  end
@@ -0,0 +1,55 @@
1
+ require_relative '../../../spec_helper'
2
+
3
+ describe AIXM::Feature::Address do
4
+ subject do
5
+ AIXM::Factory.address
6
+ end
7
+
8
+ describe :type= do
9
+ it "fails on invalid values" do
10
+ -> { subject.type = :foobar }.must_raise ArgumentError
11
+ -> { subject.type = nil }.must_raise ArgumentError
12
+ end
13
+
14
+ it "looks up valid values" do
15
+ subject.tap { |s| s.type = :phone }.type.must_equal :phone
16
+ subject.tap { |s| s.type = :RADIO }.type.must_equal :radio_frequency
17
+ end
18
+ end
19
+
20
+ describe :remarks= do
21
+ macro :remarks
22
+ end
23
+
24
+ describe :xml= do
25
+ it "builds correct OFMX" do
26
+ AIXM.ofmx!
27
+ subject.to_xml(as: :Xxx, sequence: 1).must_equal <<~END
28
+ <!-- Address: RADIO -->
29
+ <Xxx source="LF|GEN|0.0 FACTORY|0|0">
30
+ <XxxUid>
31
+ <codeType>RADIO</codeType>
32
+ <noSeq>1</noSeq>
33
+ </XxxUid>
34
+ <txtAddress>123.35</txtAddress>
35
+ <txtRmk>A/A (callsign PUJAUT)</txtRmk>
36
+ </Xxx>
37
+ END
38
+ end
39
+
40
+ it "builds correct AIXM" do
41
+ AIXM.aixm!
42
+ subject = AIXM.address(type: :weather_url, address: 'https://www.foo.bar')
43
+ subject.to_xml(as: :Xxx, sequence: 1).must_equal <<~END
44
+ <!-- Address: URL-MET -->
45
+ <Xxx>
46
+ <XxxUid>
47
+ <codeType>URL</codeType>
48
+ <noSeq>1</noSeq>
49
+ </XxxUid>
50
+ <txtAddress>https://www.foo.bar</txtAddress>
51
+ </Xxx>
52
+ END
53
+ end
54
+ end
55
+ end
@@ -13,6 +13,7 @@ describe AIXM::Feature::Airport do
13
13
  name: 'Avignon-Pujaut',
14
14
  xy: AIXM.xy(lat: %q(43°59'46"N), long: %q(004°45'16"E))
15
15
  )
16
+ subject.addresses.must_equal []
16
17
  subject.runways.must_equal []
17
18
  subject.helipads.must_equal []
18
19
  subject.usage_limitations.must_equal []
@@ -127,6 +128,18 @@ describe AIXM::Feature::Airport do
127
128
  macro :remarks
128
129
  end
129
130
 
131
+ describe :add_address do
132
+ it "fails on invalid arguments" do
133
+ -> { subject.add_address nil }.must_raise ArgumentError
134
+ end
135
+
136
+ it "adds address to the array" do
137
+ count = subject.addresses.count
138
+ subject.add_address(AIXM::Factory.address)
139
+ subject.addresses.count.must_equal count + 1
140
+ end
141
+ end
142
+
130
143
  describe :add_runway do
131
144
  it "fails on invalid arguments" do
132
145
  -> { subject.add_runway nil }.must_raise ArgumentError
@@ -181,6 +194,8 @@ describe AIXM::Feature::Airport do
181
194
  describe :to_xml do
182
195
  it "builds correct complete OFMX" do
183
196
  AIXM.ofmx!
197
+ subject.add_address(AIXM.address(source: "LF|GEN|0.0 FACTORY|0|0", type: :url, address: 'https://lfnt.tower.zone'))
198
+ subject.add_address(AIXM.address(source: "LF|GEN|0.0 FACTORY|0|0", type: :url, address: 'https://planeur-avignon-pujaut.fr'))
184
199
  subject.to_xml.must_equal <<~END
185
200
  <!-- Airport: LFNT AVIGNON-PUJAUT -->
186
201
  <Ahp source="LF|GEN|0.0 FACTORY|0|0">
@@ -214,7 +229,15 @@ describe AIXM::Feature::Airport do
214
229
  <valLen>650</valLen>
215
230
  <valWid>80</valWid>
216
231
  <uomDimRwy>M</uomDimRwy>
217
- <codeComposition>GRADE</codeComposition>
232
+ <codeComposition>ASPH</codeComposition>
233
+ <codePreparation>PAVED</codePreparation>
234
+ <codeCondSfc>GOOD</codeCondSfc>
235
+ <valPcnClass>59</valPcnClass>
236
+ <codePcnPavementType>F</codePcnPavementType>
237
+ <codePcnPavementSubgrade>A</codePcnPavementSubgrade>
238
+ <codePcnMaxTirePressure>W</codePcnMaxTirePressure>
239
+ <codePcnEvalMethod>T</codePcnEvalMethod>
240
+ <txtPcnNote>Paved shoulder on 2.5m on each side of the RWY.</txtPcnNote>
218
241
  <codeSts>CLSD</codeSts>
219
242
  <txtRmk>Markings eroded</txtRmk>
220
243
  </Rwy>
@@ -232,8 +255,9 @@ describe AIXM::Feature::Airport do
232
255
  <geoLong>004.75216944E</geoLong>
233
256
  <valTrueBrg>165</valTrueBrg>
234
257
  <valMagBrg>166</valMagBrg>
235
- <valElevTdz>147</valElevTdz>
258
+ <valElevTdz>145</valElevTdz>
236
259
  <uomElevTdz>FT</uomElevTdz>
260
+ <codeVfrPattern>E</codeVfrPattern>
237
261
  <txtRmk>forth remarks</txtRmk>
238
262
  </Rdn>
239
263
  <Rdd>
@@ -268,6 +292,9 @@ describe AIXM::Feature::Airport do
268
292
  <geoLong>004.75645556E</geoLong>
269
293
  <valTrueBrg>345</valTrueBrg>
270
294
  <valMagBrg>346</valMagBrg>
295
+ <valElevTdz>147</valElevTdz>
296
+ <uomElevTdz>FT</uomElevTdz>
297
+ <codeVfrPattern>L</codeVfrPattern>
271
298
  <txtRmk>back remarks</txtRmk>
272
299
  </Rdn>
273
300
  <Rdd>
@@ -303,7 +330,15 @@ describe AIXM::Feature::Airport do
303
330
  <valLen>20</valLen>
304
331
  <valWid>20</valWid>
305
332
  <uomDim>M</uomDim>
306
- <codeComposition>GRASS</codeComposition>
333
+ <codeComposition>CONC</codeComposition>
334
+ <codePreparation>PAVED</codePreparation>
335
+ <codeCondSfc>FAIR</codeCondSfc>
336
+ <valPcnClass>30</valPcnClass>
337
+ <codePcnPavementType>F</codePcnPavementType>
338
+ <codePcnPavementSubgrade>A</codePcnPavementSubgrade>
339
+ <codePcnMaxTirePressure>W</codePcnMaxTirePressure>
340
+ <codePcnEvalMethod>U</codePcnEvalMethod>
341
+ <txtPcnNote>Cracks near the center.</txtPcnNote>
307
342
  <codeSts>OTHER</codeSts>
308
343
  <txtRmk>Authorizaton by AD operator required</txtRmk>
309
344
  </Tla>
@@ -334,12 +369,47 @@ describe AIXM::Feature::Airport do
334
369
  <txtRmk>reservation remarks</txtRmk>
335
370
  </UsageLimitation>
336
371
  </Ahu>
372
+ <!-- Address: RADIO for LFNT -->
373
+ <Aha source="LF|GEN|0.0 FACTORY|0|0">
374
+ <AhaUid>
375
+ <AhpUid>
376
+ <codeId>LFNT</codeId>
377
+ </AhpUid>
378
+ <codeType>RADIO</codeType>
379
+ <noSeq>1</noSeq>
380
+ </AhaUid>
381
+ <txtAddress>123.35</txtAddress>
382
+ <txtRmk>A/A (callsign PUJAUT)</txtRmk>
383
+ </Aha>
384
+ <!-- Address: URL for LFNT -->
385
+ <Aha source="LF|GEN|0.0 FACTORY|0|0">
386
+ <AhaUid>
387
+ <AhpUid>
388
+ <codeId>LFNT</codeId>
389
+ </AhpUid>
390
+ <codeType>URL</codeType>
391
+ <noSeq>1</noSeq>
392
+ </AhaUid>
393
+ <txtAddress>https://lfnt.tower.zone</txtAddress>
394
+ </Aha>
395
+ <!-- Address: URL for LFNT -->
396
+ <Aha source="LF|GEN|0.0 FACTORY|0|0">
397
+ <AhaUid>
398
+ <AhpUid>
399
+ <codeId>LFNT</codeId>
400
+ </AhpUid>
401
+ <codeType>URL</codeType>
402
+ <noSeq>2</noSeq>
403
+ </AhaUid>
404
+ <txtAddress>https://planeur-avignon-pujaut.fr</txtAddress>
405
+ </Aha>
337
406
  END
338
407
  end
339
408
 
340
409
  it "builds correct minimal OFMX" do
341
410
  AIXM.ofmx!
342
411
  subject.z = subject.declination = subject.transition_z = subject.remarks = nil
412
+ subject.instance_variable_set(:'@addresses', [])
343
413
  subject.instance_variable_set(:'@runways', [])
344
414
  subject.instance_variable_set(:'@helipads', [])
345
415
  subject.instance_variable_set(:'@usage_limitations', [])
@@ -12,13 +12,23 @@ describe AIXM::Feature::NavigationalAid::DesignatedPoint do
12
12
 
13
13
  it "looks up valid values" do
14
14
  subject.tap { |s| s.type = :icao }.type.must_equal :icao
15
- subject.tap { |s| s.type = :OTHER }.type.must_equal :other
15
+ subject.tap { |s| s.type = :'VFR-RP' }.type.must_equal :vfr_reporting_point
16
+ end
17
+ end
18
+
19
+ describe :airport= do
20
+ it "fails on invalid values" do
21
+ [:foobar, 123].wont_be_written_to subject, :airport
22
+ end
23
+
24
+ it "accepts valid values" do
25
+ [nil, AIXM::Factory.airport].must_be_written_to subject, :airport
16
26
  end
17
27
  end
18
28
 
19
29
  describe :kind do
20
30
  it "must return class/type combo" do
21
- subject.kind.must_equal "DesignatedPoint:ICAO"
31
+ subject.kind.must_equal "DesignatedPoint:VFR-RP"
22
32
  end
23
33
  end
24
34
 
@@ -26,15 +36,18 @@ describe AIXM::Feature::NavigationalAid::DesignatedPoint do
26
36
  it "builds correct complete OFMX" do
27
37
  AIXM.ofmx!
28
38
  subject.to_xml.must_equal <<~END
29
- <!-- NavigationalAid: [DesignatedPoint:ICAO] DESIGNATED POINT NAVAID -->
39
+ <!-- NavigationalAid: [DesignatedPoint:VFR-RP] DDD / DESIGNATED POINT NAVAID -->
30
40
  <Dpn source="LF|GEN|0.0 FACTORY|0|0">
31
41
  <DpnUid>
32
42
  <codeId>DDD</codeId>
33
43
  <geoLat>47.85916667N</geoLat>
34
44
  <geoLong>007.56000000E</geoLong>
35
45
  </DpnUid>
46
+ <AhpUidAssoc>
47
+ <codeId>LFNT</codeId>
48
+ </AhpUidAssoc>
36
49
  <codeDatum>WGE</codeDatum>
37
- <codeType>ICAO</codeType>
50
+ <codeType>VFR-RP</codeType>
38
51
  <txtName>DESIGNATED POINT NAVAID</txtName>
39
52
  <txtRmk>designated point navaid</txtRmk>
40
53
  </Dpn>
@@ -45,15 +58,39 @@ describe AIXM::Feature::NavigationalAid::DesignatedPoint do
45
58
  AIXM.ofmx!
46
59
  subject.name = subject.remarks = nil
47
60
  subject.to_xml.must_equal <<~END
48
- <!-- NavigationalAid: [DesignatedPoint:ICAO] UNNAMED -->
61
+ <!-- NavigationalAid: [DesignatedPoint:VFR-RP] DDD -->
49
62
  <Dpn source="LF|GEN|0.0 FACTORY|0|0">
50
63
  <DpnUid>
51
64
  <codeId>DDD</codeId>
52
65
  <geoLat>47.85916667N</geoLat>
53
66
  <geoLong>007.56000000E</geoLong>
54
67
  </DpnUid>
68
+ <AhpUidAssoc>
69
+ <codeId>LFNT</codeId>
70
+ </AhpUidAssoc>
71
+ <codeDatum>WGE</codeDatum>
72
+ <codeType>VFR-RP</codeType>
73
+ </Dpn>
74
+ END
75
+ end
76
+
77
+ it "builds correct complete OFMX" do
78
+ AIXM.aixm!
79
+ subject.to_xml.must_equal <<~END
80
+ <!-- NavigationalAid: [DesignatedPoint:VFR-RP] DDD / DESIGNATED POINT NAVAID -->
81
+ <Dpn>
82
+ <DpnUid>
83
+ <codeId>DDD</codeId>
84
+ <geoLat>475133.00N</geoLat>
85
+ <geoLong>0073336.00E</geoLong>
86
+ </DpnUid>
87
+ <AhpUidAssoc>
88
+ <codeId>LFNT</codeId>
89
+ </AhpUidAssoc>
55
90
  <codeDatum>WGE</codeDatum>
56
- <codeType>ICAO</codeType>
91
+ <codeType>OTHER</codeType>
92
+ <txtName>DESIGNATED POINT NAVAID</txtName>
93
+ <txtRmk>designated point navaid</txtRmk>
57
94
  </Dpn>
58
95
  END
59
96
  end
@@ -42,7 +42,7 @@ describe AIXM::Feature::NavigationalAid::DME do
42
42
  it "builds correct complete OFMX" do
43
43
  AIXM.ofmx!
44
44
  subject.to_xml.must_equal <<~END
45
- <!-- NavigationalAid: [DME] DME NAVAID -->
45
+ <!-- NavigationalAid: [DME] MMM / DME NAVAID -->
46
46
  <Dme source="LF|GEN|0.0 FACTORY|0|0">
47
47
  <DmeUid>
48
48
  <codeId>MMM</codeId>
@@ -71,7 +71,7 @@ describe AIXM::Feature::NavigationalAid::DME do
71
71
  AIXM.ofmx!
72
72
  subject.name = subject.z = subject.timetable = subject.remarks = nil
73
73
  subject.to_xml.must_equal <<~END
74
- <!-- NavigationalAid: [DME] UNNAMED -->
74
+ <!-- NavigationalAid: [DME] MMM -->
75
75
  <Dme source="LF|GEN|0.0 FACTORY|0|0">
76
76
  <DmeUid>
77
77
  <codeId>MMM</codeId>
@@ -30,7 +30,7 @@ describe AIXM::Feature::NavigationalAid::Marker do
30
30
  it "builds correct complete OFMX" do
31
31
  AIXM.ofmx!
32
32
  subject.to_xml.must_equal <<~END
33
- <!-- NavigationalAid: [Marker:O] MARKER NAVAID -->
33
+ <!-- NavigationalAid: [Marker:O] --- / MARKER NAVAID -->
34
34
  <Mkr source="LF|GEN|0.0 FACTORY|0|0">
35
35
  <MkrUid>
36
36
  <codeId>---</codeId>
@@ -59,7 +59,7 @@ describe AIXM::Feature::NavigationalAid::Marker do
59
59
  AIXM.ofmx!
60
60
  subject.type = subject.name = subject.z = subject.timetable = subject.remarks = nil
61
61
  subject.to_xml.must_equal <<~END
62
- <!-- NavigationalAid: [Marker] UNNAMED -->
62
+ <!-- NavigationalAid: [Marker] --- -->
63
63
  <Mkr source="LF|GEN|0.0 FACTORY|0|0">
64
64
  <MkrUid>
65
65
  <codeId>---</codeId>
@@ -40,7 +40,7 @@ describe AIXM::Feature::NavigationalAid::NDB do
40
40
  it "builds correct complete OFMX" do
41
41
  AIXM.ofmx!
42
42
  subject.to_xml.must_equal <<~END
43
- <!-- NavigationalAid: [NDB:B] NDB NAVAID -->
43
+ <!-- NavigationalAid: [NDB:B] NNN / NDB NAVAID -->
44
44
  <Ndb source="LF|GEN|0.0 FACTORY|0|0">
45
45
  <NdbUid>
46
46
  <codeId>NNN</codeId>
@@ -69,7 +69,7 @@ describe AIXM::Feature::NavigationalAid::NDB do
69
69
  AIXM.ofmx!
70
70
  subject.name = subject.type = subject.z = subject.timetable = subject.remarks = nil
71
71
  subject.to_xml.must_equal <<~END
72
- <!-- NavigationalAid: [NDB] UNNAMED -->
72
+ <!-- NavigationalAid: [NDB] NNN -->
73
73
  <Ndb source="LF|GEN|0.0 FACTORY|0|0">
74
74
  <NdbUid>
75
75
  <codeId>NNN</codeId>
@@ -38,7 +38,7 @@ describe AIXM::Feature::NavigationalAid::TACAN do
38
38
  it "builds correct complete OFMX" do
39
39
  AIXM.ofmx!
40
40
  subject.to_xml.must_equal <<~END
41
- <!-- NavigationalAid: [TACAN] TACAN NAVAID -->
41
+ <!-- NavigationalAid: [TACAN] TTT / TACAN NAVAID -->
42
42
  <Tcn source="LF|GEN|0.0 FACTORY|0|0">
43
43
  <TcnUid>
44
44
  <codeId>TTT</codeId>
@@ -67,7 +67,7 @@ describe AIXM::Feature::NavigationalAid::TACAN do
67
67
  AIXM.ofmx!
68
68
  subject.name = subject.z = subject.timetable = subject.remarks = nil
69
69
  subject.to_xml.must_equal <<~END
70
- <!-- NavigationalAid: [TACAN] UNNAMED -->
70
+ <!-- NavigationalAid: [TACAN] TTT -->
71
71
  <Tcn source="LF|GEN|0.0 FACTORY|0|0">
72
72
  <TcnUid>
73
73
  <codeId>TTT</codeId>
@@ -48,7 +48,7 @@ describe AIXM::Feature::NavigationalAid::VOR do
48
48
  it "builds correct complete OFMX" do
49
49
  AIXM.ofmx!
50
50
  subject.to_xml.must_equal <<~END
51
- <!-- NavigationalAid: [VOR:VOR] VOR NAVAID -->
51
+ <!-- NavigationalAid: [VOR:VOR] VVV / VOR NAVAID -->
52
52
  <Vor source="LF|GEN|0.0 FACTORY|0|0">
53
53
  <VorUid>
54
54
  <codeId>VVV</codeId>
@@ -78,7 +78,7 @@ describe AIXM::Feature::NavigationalAid::VOR do
78
78
  AIXM.ofmx!
79
79
  subject.name = subject.z = subject.timetable = subject.remarks = nil
80
80
  subject.to_xml.must_equal <<~END
81
- <!-- NavigationalAid: [VOR:VOR] UNNAMED -->
81
+ <!-- NavigationalAid: [VOR:VOR] VVV -->
82
82
  <Vor source="LF|GEN|0.0 FACTORY|0|0">
83
83
  <VorUid>
84
84
  <codeId>VVV</codeId>
@@ -118,7 +118,7 @@ describe AIXM::Feature::NavigationalAid::VOR do
118
118
  it "builds correct OFMX" do
119
119
  AIXM.ofmx!
120
120
  subject.to_xml.must_equal <<~END
121
- <!-- NavigationalAid: [VOR:VOR] VOR/DME NAVAID -->
121
+ <!-- NavigationalAid: [VOR:VOR] VVV / VOR/DME NAVAID -->
122
122
  <Vor source="LF|GEN|0.0 FACTORY|0|0">
123
123
  <VorUid>
124
124
  <codeId>VVV</codeId>
@@ -141,7 +141,7 @@ describe AIXM::Feature::NavigationalAid::VOR do
141
141
  </Vtt>
142
142
  <txtRmk>vor/dme navaid</txtRmk>
143
143
  </Vor>
144
- <!-- NavigationalAid: [DME] VOR/DME NAVAID -->
144
+ <!-- NavigationalAid: [DME] VVV / VOR/DME NAVAID -->
145
145
  <Dme>
146
146
  <DmeUid>
147
147
  <codeId>VVV</codeId>
@@ -190,7 +190,7 @@ describe AIXM::Feature::NavigationalAid::VOR do
190
190
  it "builds correct OFMX" do
191
191
  AIXM.ofmx!
192
192
  subject.to_xml.must_equal <<~END
193
- <!-- NavigationalAid: [VOR:VOR] VORTAC NAVAID -->
193
+ <!-- NavigationalAid: [VOR:VOR] VVV / VORTAC NAVAID -->
194
194
  <Vor source="LF|GEN|0.0 FACTORY|0|0">
195
195
  <VorUid>
196
196
  <codeId>VVV</codeId>
@@ -213,7 +213,7 @@ describe AIXM::Feature::NavigationalAid::VOR do
213
213
  </Vtt>
214
214
  <txtRmk>vortac navaid</txtRmk>
215
215
  </Vor>
216
- <!-- NavigationalAid: [TACAN] VORTAC NAVAID -->
216
+ <!-- NavigationalAid: [TACAN] VVV / VORTAC NAVAID -->
217
217
  <Tcn>
218
218
  <TcnUid>
219
219
  <codeId>VVV</codeId>
@@ -1,31 +1,19 @@
1
1
  require_relative '../../../spec_helper'
2
2
 
3
- describe AIXM::Component::Service do
3
+ describe AIXM::Feature::Service do
4
4
  subject do
5
5
  AIXM::Factory.service
6
6
  end
7
7
 
8
8
  describe :initialize do
9
9
  it "sets defaults" do
10
- subject = AIXM::Component::Service.new(
11
- name: "PUJAUT TOWER",
10
+ subject = AIXM::Feature::Service.new(
12
11
  type: :approach_control_service
13
12
  )
14
13
  subject.frequencies.must_equal []
15
14
  end
16
15
  end
17
16
 
18
- describe :name= do
19
- it "fails on invalid values" do
20
- -> { subject.name = :foobar }.must_raise ArgumentError
21
- -> { subject.name = nil }.must_raise ArgumentError
22
- end
23
-
24
- it "upcases and transcodes valid values" do
25
- subject.tap { |s| s.name = 'Nîmes-Alès' }.name.must_equal 'NIMES-ALES'
26
- end
27
- end
28
-
29
17
  describe :type= do
30
18
  it "fails on invalid values" do
31
19
  -> { subject.type = :foobar }.must_raise ArgumentError
@@ -58,4 +46,14 @@ describe AIXM::Component::Service do
58
46
  end
59
47
  end
60
48
 
49
+ describe :guess_unit_type do
50
+ it "finds the probably unit type for a matchable service" do
51
+ subject.tap { |s| s.type = :flight_information_service }.guessed_unit_type.must_equal :flight_information_centre
52
+ end
53
+
54
+ it "returns nil for an unmatchable service" do
55
+ subject.tap { |s| s.type = :aeronautical_mobile_satellite_service }.guessed_unit_type.must_be_nil
56
+ end
57
+ end
58
+
61
59
  end