aixm 0.3.7 → 0.3.8

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 (81) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +26 -0
  3. data/.ruby-version +1 -1
  4. data/CHANGELOG.md +17 -4
  5. data/README.md +23 -5
  6. data/lib/aixm/component/fato.rb +3 -3
  7. data/lib/aixm/component/frequency.rb +1 -1
  8. data/lib/aixm/component/geometry/border.rb +9 -3
  9. data/lib/aixm/component/helipad.rb +1 -1
  10. data/lib/aixm/component/lighting.rb +1 -1
  11. data/lib/aixm/component/runway.rb +4 -7
  12. data/lib/aixm/config.rb +2 -1
  13. data/lib/aixm/document.rb +1 -0
  14. data/lib/aixm/feature/address.rb +1 -1
  15. data/lib/aixm/feature/airport.rb +13 -4
  16. data/lib/aixm/feature/airspace.rb +11 -8
  17. data/lib/aixm/feature/navigational_aid/designated_point.rb +1 -1
  18. data/lib/aixm/feature/navigational_aid/dme.rb +1 -1
  19. data/lib/aixm/feature/navigational_aid/marker.rb +1 -1
  20. data/lib/aixm/feature/navigational_aid/ndb.rb +1 -1
  21. data/lib/aixm/feature/navigational_aid/tacan.rb +1 -1
  22. data/lib/aixm/feature/navigational_aid/vor.rb +1 -1
  23. data/lib/aixm/feature/obstacle.rb +1 -1
  24. data/lib/aixm/feature/obstacle_group.rb +1 -1
  25. data/lib/aixm/feature/organisation.rb +1 -1
  26. data/lib/aixm/feature/service.rb +1 -1
  27. data/lib/aixm/feature/unit.rb +1 -1
  28. data/lib/aixm/refinements.rb +39 -8
  29. data/lib/aixm/version.rb +1 -1
  30. data/rakefile.rb +22 -8
  31. data/spec/lib/aixm/a_spec.rb +55 -55
  32. data/spec/lib/aixm/component/fato_spec.rb +30 -23
  33. data/spec/lib/aixm/component/frequency_spec.rb +12 -13
  34. data/spec/lib/aixm/component/geometry/arc_spec.rb +7 -9
  35. data/spec/lib/aixm/component/geometry/border_spec.rb +8 -3
  36. data/spec/lib/aixm/component/geometry/circle_spec.rb +6 -8
  37. data/spec/lib/aixm/component/geometry/point_spec.rb +2 -4
  38. data/spec/lib/aixm/component/geometry_spec.rb +57 -62
  39. data/spec/lib/aixm/component/helipad_spec.rb +25 -19
  40. data/spec/lib/aixm/component/layer_spec.rb +17 -19
  41. data/spec/lib/aixm/component/lighting_spec.rb +21 -15
  42. data/spec/lib/aixm/component/runway_spec.rb +44 -37
  43. data/spec/lib/aixm/component/surface_spec.rb +24 -24
  44. data/spec/lib/aixm/component/timetable_spec.rb +7 -9
  45. data/spec/lib/aixm/component/vertical_limits_spec.rb +9 -12
  46. data/spec/lib/aixm/config_spec.rb +8 -8
  47. data/spec/lib/aixm/d_spec.rb +28 -28
  48. data/spec/lib/aixm/document_spec.rb +46 -37
  49. data/spec/lib/aixm/errors_spec.rb +2 -2
  50. data/spec/lib/aixm/f_spec.rb +16 -16
  51. data/spec/lib/aixm/feature/address_spec.rb +12 -7
  52. data/spec/lib/aixm/feature/airport_spec.rb +80 -74
  53. data/spec/lib/aixm/feature/airspace_spec.rb +32 -28
  54. data/spec/lib/aixm/feature/navigational_aid/designated_point_spec.rb +16 -11
  55. data/spec/lib/aixm/feature/navigational_aid/dme_spec.rb +22 -16
  56. data/spec/lib/aixm/feature/navigational_aid/marker_spec.rb +13 -7
  57. data/spec/lib/aixm/feature/navigational_aid/ndb_spec.rb +15 -9
  58. data/spec/lib/aixm/feature/navigational_aid/tacan_spec.rb +22 -16
  59. data/spec/lib/aixm/feature/navigational_aid/vor_spec.rb +21 -15
  60. data/spec/lib/aixm/feature/navigational_aid_spec.rb +6 -6
  61. data/spec/lib/aixm/feature/obstacle_group_spec.rb +25 -21
  62. data/spec/lib/aixm/feature/obstacle_spec.rb +47 -42
  63. data/spec/lib/aixm/feature/organisation_spec.rb +16 -10
  64. data/spec/lib/aixm/feature/service_spec.rb +9 -9
  65. data/spec/lib/aixm/feature/unit_spec.rb +21 -13
  66. data/spec/lib/aixm/feature_spec.rb +5 -5
  67. data/spec/lib/aixm/p_spec.rb +37 -37
  68. data/spec/lib/aixm/refinements_spec.rb +164 -115
  69. data/spec/lib/aixm/version_spec.rb +1 -1
  70. data/spec/lib/aixm/w_spec.rb +28 -28
  71. data/spec/lib/aixm/xy_spec.rb +34 -34
  72. data/spec/lib/aixm/z_spec.rb +19 -19
  73. data/spec/macros/marking.rb +3 -3
  74. data/spec/macros/organisation.rb +2 -2
  75. data/spec/macros/remarks.rb +3 -3
  76. data/spec/macros/timetable.rb +2 -2
  77. data/spec/macros/xy.rb +2 -2
  78. data/spec/macros/z_qnh.rb +2 -2
  79. data/spec/spec_helper.rb +7 -0
  80. metadata +3 -3
  81. data/.travis.yml +0 -8
@@ -9,81 +9,81 @@ describe AIXM::Feature::Airspace do
9
9
 
10
10
  describe :initialize do
11
11
  it "sets defaults" do
12
- subject.id.must_equal 'C55466EC'
13
- subject.layers.must_equal []
14
- subject.geometry.must_be_instance_of AIXM::Component::Geometry
12
+ _(subject.id).must_equal 'C55466EC'
13
+ _(subject.layers).must_equal []
14
+ _(subject.geometry).must_be_instance_of AIXM::Component::Geometry
15
15
  end
16
16
  end
17
17
 
18
18
  describe :id= do
19
19
  it "fails on invalid values" do
20
- [:foobar, 123].wont_be_written_to subject, :id
20
+ _([:foobar, 123]).wont_be_written_to subject, :id
21
21
  end
22
22
 
23
23
  it "falls back to id derived from digest of type, local_type and name" do
24
- subject.tap { |s| s.id = nil }.id.must_equal 'C55466EC'
24
+ _(subject.tap { |s| s.id = nil }.id).must_equal 'C55466EC'
25
25
  end
26
26
 
27
27
  it "upcases value" do
28
- subject.tap { |s| s.id = 'löl' }.id.must_equal 'LOEL'
28
+ _(subject.tap { |s| s.id = 'löl' }.id).must_equal 'LOEL'
29
29
  end
30
30
  end
31
31
 
32
32
  describe :type= do
33
33
  it "fails on invalid values" do
34
- [nil, :foobar, 123].wont_be_written_to subject, :type
34
+ _([nil, :foobar, 123]).wont_be_written_to subject, :type
35
35
  end
36
36
 
37
37
  it "looks up valid values" do
38
- subject.tap { |s| s.type = :danger_area }.type.must_equal :danger_area
39
- subject.tap { |s| s.type = :P }.type.must_equal :prohibited_area
38
+ _(subject.tap { |s| s.type = :danger_area }.type).must_equal :danger_area
39
+ _(subject.tap { |s| s.type = :P }.type).must_equal :prohibited_area
40
40
  end
41
41
  end
42
42
 
43
43
  describe :local_type= do
44
44
  it "fails on invalid values" do
45
- [:foobar, 123].wont_be_written_to subject, :local_type
45
+ _([:foobar, 123]).wont_be_written_to subject, :local_type
46
46
  end
47
47
 
48
48
  it "accepts nil value" do
49
- [nil].must_be_written_to subject, :local_type
49
+ _([nil]).must_be_written_to subject, :local_type
50
50
  end
51
51
 
52
52
  it "upcases value" do
53
- subject.tap { |s| s.local_type = 'löl' }.local_type.must_equal 'LOEL'
53
+ _(subject.tap { |s| s.local_type = 'löl' }.local_type).must_equal 'LOEL'
54
54
  end
55
55
  end
56
56
 
57
57
  describe :name= do
58
58
  it "fails on invalid values" do
59
- [:foobar, 123].wont_be_written_to subject, :name
59
+ _([:foobar, 123]).wont_be_written_to subject, :name
60
60
  end
61
61
 
62
62
  it "accepts nil value" do
63
- [nil].must_be_written_to subject, :name
63
+ _([nil]).must_be_written_to subject, :name
64
64
  end
65
65
 
66
66
  it "upcases value" do
67
- subject.tap { |s| s.name = 'löl' }.name.must_equal 'LOEL'
67
+ _(subject.tap { |s| s.name = 'löl' }.name).must_equal 'LOEL'
68
68
  end
69
69
  end
70
70
 
71
71
  describe :to_uid do
72
72
  it "builds with arbitrary tag" do
73
- subject.to_uid.must_match(/<AseUid>/)
74
- subject.to_uid(as: :FooBar).must_match(/<FooBar>/)
73
+ _(subject.to_uid).must_match(/<AseUid>/)
74
+ _(subject.to_uid(as: :FooBar)).must_match(/<FooBar>/)
75
75
  end
76
76
  end
77
77
 
78
78
  describe :to_xml do
79
79
  it "fails to build AIXM since geometry is not closed" do
80
80
  subject.layers << AIXM::Factory.layer
81
- -> { subject.to_xml }.must_raise AIXM::GeometryError
81
+ _{ subject.to_xml }.must_raise AIXM::GeometryError
82
82
  end
83
83
 
84
84
  it "fails to build AIXM since layers are not defined" do
85
85
  subject.geometry = AIXM::Factory.circle_geometry
86
- -> { subject.to_xml }.must_raise AIXM::LayerError
86
+ _{ subject.to_xml }.must_raise AIXM::LayerError
87
87
  end
88
88
  end
89
89
  end
@@ -98,18 +98,15 @@ describe AIXM::Feature::Airspace do
98
98
 
99
99
  describe :to_xml do
100
100
  it "builds correct AIXM without id" do
101
- AIXM.aixm!
102
- subject.to_xml.must_match(%r{<codeId>C55466EC</codeId>})
101
+ _(subject.to_xml).must_match(%r{<codeId>C55466EC</codeId>})
103
102
  end
104
103
 
105
104
  it "builds correct AIXM without short name" do
106
- AIXM.aixm!
107
- subject.to_xml.wont_match(/<txtLocalType>/)
105
+ _(subject.to_xml).wont_match(/<txtLocalType>/)
108
106
  end
109
107
 
110
108
  it "builds correct AIXM with identical name and short name" do
111
- AIXM.aixm!
112
- subject.to_xml.wont_match(/<txtLocalType>/)
109
+ _(subject.to_xml).wont_match(/<txtLocalType>/)
113
110
  end
114
111
  end
115
112
  end
@@ -122,7 +119,7 @@ describe AIXM::Feature::Airspace do
122
119
  describe :to_xml do
123
120
  it "builds correct complete OFMX" do
124
121
  AIXM.ofmx!
125
- subject.to_xml.must_equal <<~"END"
122
+ _(subject.to_xml).must_equal <<~"END"
126
123
  <!-- Airspace: [D] POLYGON AIRSPACE -->
127
124
  <Ase source="LF|GEN|0.0 FACTORY|0|0">
128
125
  <AseUid>
@@ -189,7 +186,7 @@ describe AIXM::Feature::Airspace do
189
186
  it "builds correct minimal OFMX" do
190
187
  AIXM.ofmx!
191
188
  subject.local_type = subject.name = nil
192
- subject.to_xml.must_equal <<~"END"
189
+ _(subject.to_xml).must_equal <<~"END"
193
190
  <!-- Airspace: [D] UNNAMED -->
194
191
  <Ase source="LF|GEN|0.0 FACTORY|0|0">
195
192
  <AseUid>
@@ -251,6 +248,13 @@ describe AIXM::Feature::Airspace do
251
248
  END
252
249
  end
253
250
  end
251
+
252
+ it "builds OFMX with mid" do
253
+ AIXM.ofmx!
254
+ AIXM.config.mid_region = 'LF'
255
+ _(subject.to_xml).must_match /<AseUid mid="8894c821-b486-8128-48f2-a47c2e9f4c13">/
256
+ # _(subject.to_xml).must_match /<AbdUid mid="">/
257
+ end
254
258
  end
255
259
 
256
260
  context "with two layers" do
@@ -263,7 +267,7 @@ describe AIXM::Feature::Airspace do
263
267
  describe :to_xml do
264
268
  it "builds correct OFMX" do
265
269
  AIXM.ofmx!
266
- subject.to_xml.must_equal <<~"END"
270
+ _(subject.to_xml).must_equal <<~"END"
267
271
  <!-- Airspace: [D] POLYGON AIRSPACE -->
268
272
  <Ase source="LF|GEN|0.0 FACTORY|0|0">
269
273
  <AseUid>
@@ -7,35 +7,35 @@ describe AIXM::Feature::NavigationalAid::DesignatedPoint do
7
7
 
8
8
  describe :type= do
9
9
  it "fails on invalid values" do
10
- [nil, :foobar, 123].wont_be_written_to subject, :type
10
+ _([nil, :foobar, 123]).wont_be_written_to subject, :type
11
11
  end
12
12
 
13
13
  it "looks up valid values" do
14
- subject.tap { |s| s.type = :icao }.type.must_equal :icao
15
- subject.tap { |s| s.type = :'VFR-RP' }.type.must_equal :vfr_reporting_point
14
+ _(subject.tap { |s| s.type = :icao }.type).must_equal :icao
15
+ _(subject.tap { |s| s.type = :'VFR-RP' }.type).must_equal :vfr_reporting_point
16
16
  end
17
17
  end
18
18
 
19
19
  describe :airport= do
20
20
  it "fails on invalid values" do
21
- [:foobar, 123].wont_be_written_to subject, :airport
21
+ _([:foobar, 123]).wont_be_written_to subject, :airport
22
22
  end
23
23
 
24
24
  it "accepts valid values" do
25
- [nil, AIXM::Factory.airport].must_be_written_to subject, :airport
25
+ _([nil, AIXM::Factory.airport]).must_be_written_to subject, :airport
26
26
  end
27
27
  end
28
28
 
29
29
  describe :kind do
30
30
  it "must return class/type combo" do
31
- subject.kind.must_equal "DesignatedPoint:VFR-RP"
31
+ _(subject.kind).must_equal "DesignatedPoint:VFR-RP"
32
32
  end
33
33
  end
34
34
 
35
35
  describe :to_xml do
36
36
  it "builds correct complete OFMX" do
37
37
  AIXM.ofmx!
38
- subject.to_xml.must_equal <<~END
38
+ _(subject.to_xml).must_equal <<~END
39
39
  <!-- NavigationalAid: [DesignatedPoint:VFR-RP] DDD / DESIGNATED POINT NAVAID -->
40
40
  <Dpn source="LF|GEN|0.0 FACTORY|0|0">
41
41
  <DpnUid>
@@ -57,7 +57,7 @@ describe AIXM::Feature::NavigationalAid::DesignatedPoint do
57
57
  it "builds correct minimal OFMX" do
58
58
  AIXM.ofmx!
59
59
  subject.name = subject.remarks = nil
60
- subject.to_xml.must_equal <<~END
60
+ _(subject.to_xml).must_equal <<~END
61
61
  <!-- NavigationalAid: [DesignatedPoint:VFR-RP] DDD -->
62
62
  <Dpn source="LF|GEN|0.0 FACTORY|0|0">
63
63
  <DpnUid>
@@ -74,9 +74,14 @@ describe AIXM::Feature::NavigationalAid::DesignatedPoint do
74
74
  END
75
75
  end
76
76
 
77
- it "builds correct complete OFMX" do
78
- AIXM.aixm!
79
- subject.to_xml.must_equal <<~END
77
+ it "builds OFMX with mid" do
78
+ AIXM.ofmx!
79
+ AIXM.config.mid_region = 'LF'
80
+ _(subject.to_xml).must_match /<DpnUid mid="b2977fe4-c591-0e72-8a5f-2e30d80f92d6">/
81
+ end
82
+
83
+ it "builds correct complete AIXM" do
84
+ _(subject.to_xml).must_equal <<~END
80
85
  <!-- NavigationalAid: [DesignatedPoint:VFR-RP] DDD / DESIGNATED POINT NAVAID -->
81
86
  <Dpn>
82
87
  <DpnUid>
@@ -11,37 +11,37 @@ describe AIXM::Feature::NavigationalAid::DME do
11
11
 
12
12
  describe :channel= do
13
13
  it "fails on invalid values" do
14
- [nil, :foobar, 123, '0X', '127Y', '12Z'].wont_be_written_to subject, :channel
14
+ _([nil, :foobar, 123, '0X', '127Y', '12Z']).wont_be_written_to subject, :channel
15
15
  end
16
16
  end
17
17
 
18
18
  describe :ghost_f do
19
19
  it "must be derived from the channel" do
20
- subject.tap { |s| s.channel = '1X' }.ghost_f.freq.must_equal 134.4
21
- subject.tap { |s| s.channel = '12Y' }.ghost_f.freq.must_equal 135.55
22
- subject.tap { |s| s.channel = '16Y' }.ghost_f.freq.must_equal 135.95
23
- subject.tap { |s| s.channel = '17X' }.ghost_f.freq.must_equal 108
24
- subject.tap { |s| s.channel = '30X' }.ghost_f.freq.must_equal 109.3
25
- subject.tap { |s| s.channel = '59Y' }.ghost_f.freq.must_equal 112.25
26
- subject.tap { |s| s.channel = '60X' }.ghost_f.freq.must_equal 133.3
27
- subject.tap { |s| s.channel = '64Y' }.ghost_f.freq.must_equal 133.75
28
- subject.tap { |s| s.channel = '69Y' }.ghost_f.freq.must_equal 134.25
29
- subject.tap { |s| s.channel = '70X' }.ghost_f.freq.must_equal 112.30
30
- subject.tap { |s| s.channel = '100X' }.ghost_f.freq.must_equal 115.3
31
- subject.tap { |s| s.channel = '126Y' }.ghost_f.freq.must_equal 117.95
20
+ _(subject.tap { |s| s.channel = '1X' }.ghost_f.freq).must_equal 134.4
21
+ _(subject.tap { |s| s.channel = '12Y' }.ghost_f.freq).must_equal 135.55
22
+ _(subject.tap { |s| s.channel = '16Y' }.ghost_f.freq).must_equal 135.95
23
+ _(subject.tap { |s| s.channel = '17X' }.ghost_f.freq).must_equal 108
24
+ _(subject.tap { |s| s.channel = '30X' }.ghost_f.freq).must_equal 109.3
25
+ _(subject.tap { |s| s.channel = '59Y' }.ghost_f.freq).must_equal 112.25
26
+ _(subject.tap { |s| s.channel = '60X' }.ghost_f.freq).must_equal 133.3
27
+ _(subject.tap { |s| s.channel = '64Y' }.ghost_f.freq).must_equal 133.75
28
+ _(subject.tap { |s| s.channel = '69Y' }.ghost_f.freq).must_equal 134.25
29
+ _(subject.tap { |s| s.channel = '70X' }.ghost_f.freq).must_equal 112.30
30
+ _(subject.tap { |s| s.channel = '100X' }.ghost_f.freq).must_equal 115.3
31
+ _(subject.tap { |s| s.channel = '126Y' }.ghost_f.freq).must_equal 117.95
32
32
  end
33
33
  end
34
34
 
35
35
  describe :kind do
36
36
  it "must return class/type combo" do
37
- subject.kind.must_equal "DME"
37
+ _(subject.kind).must_equal "DME"
38
38
  end
39
39
  end
40
40
 
41
41
  describe :to_xml do
42
42
  it "builds correct complete OFMX" do
43
43
  AIXM.ofmx!
44
- subject.to_xml.must_equal <<~END
44
+ _(subject.to_xml).must_equal <<~END
45
45
  <!-- NavigationalAid: [DME] MMM / DME NAVAID -->
46
46
  <Dme source="LF|GEN|0.0 FACTORY|0|0">
47
47
  <DmeUid>
@@ -70,7 +70,7 @@ describe AIXM::Feature::NavigationalAid::DME do
70
70
  it "builds correct minimal OFMX" do
71
71
  AIXM.ofmx!
72
72
  subject.name = subject.z = subject.timetable = subject.remarks = nil
73
- subject.to_xml.must_equal <<~END
73
+ _(subject.to_xml).must_equal <<~END
74
74
  <!-- NavigationalAid: [DME] MMM -->
75
75
  <Dme source="LF|GEN|0.0 FACTORY|0|0">
76
76
  <DmeUid>
@@ -88,5 +88,11 @@ describe AIXM::Feature::NavigationalAid::DME do
88
88
  </Dme>
89
89
  END
90
90
  end
91
+
92
+ it "builds OFMX with mid" do
93
+ AIXM.ofmx!
94
+ AIXM.config.mid_region = 'LF'
95
+ _(subject.to_xml).must_match /<DmeUid mid="b3ecd57d-529d-4941-97b8-af5ffa089051">/
96
+ end
91
97
  end
92
98
  end
@@ -7,29 +7,29 @@ describe AIXM::Feature::NavigationalAid::Marker do
7
7
 
8
8
  describe :type= do
9
9
  it "fails on invalid values" do
10
- [:foobar, 123].wont_be_written_to subject, :type
10
+ _([:foobar, 123]).wont_be_written_to subject, :type
11
11
  end
12
12
 
13
13
  it "accepts nil value" do
14
- [nil].must_be_written_to subject, :name
14
+ _([nil]).must_be_written_to subject, :name
15
15
  end
16
16
 
17
17
  it "looks up valid values" do
18
- subject.tap { |s| s.type = :middle }.type.must_equal :middle
19
- subject.tap { |s| s.type = :O }.type.must_equal :outer
18
+ _(subject.tap { |s| s.type = :middle }.type).must_equal :middle
19
+ _(subject.tap { |s| s.type = :O }.type).must_equal :outer
20
20
  end
21
21
  end
22
22
 
23
23
  describe :kind do
24
24
  it "must return class/type combo" do
25
- subject.kind.must_equal "Marker:O"
25
+ _(subject.kind).must_equal "Marker:O"
26
26
  end
27
27
  end
28
28
 
29
29
  describe :to_xml do
30
30
  it "builds correct complete OFMX" do
31
31
  AIXM.ofmx!
32
- subject.to_xml.must_equal <<~END
32
+ _(subject.to_xml).must_equal <<~END
33
33
  <!-- NavigationalAid: [Marker:O] --- / MARKER NAVAID -->
34
34
  <Mkr source="LF|GEN|0.0 FACTORY|0|0">
35
35
  <MkrUid>
@@ -58,7 +58,7 @@ describe AIXM::Feature::NavigationalAid::Marker do
58
58
  it "builds correct minimal OFMX" do
59
59
  AIXM.ofmx!
60
60
  subject.type = subject.name = subject.z = subject.timetable = subject.remarks = nil
61
- subject.to_xml.must_equal <<~END
61
+ _(subject.to_xml).must_equal <<~END
62
62
  <!-- NavigationalAid: [Marker] --- -->
63
63
  <Mkr source="LF|GEN|0.0 FACTORY|0|0">
64
64
  <MkrUid>
@@ -75,5 +75,11 @@ describe AIXM::Feature::NavigationalAid::Marker do
75
75
  </Mkr>
76
76
  END
77
77
  end
78
+
79
+ it "builds OFMX with mid" do
80
+ AIXM.ofmx!
81
+ AIXM.config.mid_region = 'LF'
82
+ _(subject.to_xml).must_match /<MkrUid mid="f3463c39-b380-d31f-b42a-5dfa0b4edb12">/
83
+ end
78
84
  end
79
85
  end
@@ -7,39 +7,39 @@ describe AIXM::Feature::NavigationalAid::NDB do
7
7
 
8
8
  describe :type= do
9
9
  it "fails on invalid values" do
10
- [:foobar, 123].wont_be_written_to subject, :type
10
+ _([:foobar, 123]).wont_be_written_to subject, :type
11
11
  end
12
12
 
13
13
  it "accepts nil value" do
14
- [nil].must_be_written_to subject, :type
14
+ _([nil]).must_be_written_to subject, :type
15
15
  end
16
16
 
17
17
  it "looks up valid values" do
18
- subject.tap { |s| s.type = :en_route }.type.must_equal :en_route
19
- subject.tap { |s| s.type = :L }.type.must_equal :locator
18
+ _(subject.tap { |s| s.type = :en_route }.type).must_equal :en_route
19
+ _(subject.tap { |s| s.type = :L }.type).must_equal :locator
20
20
  end
21
21
  end
22
22
 
23
23
  describe :f= do
24
24
  it "fails on invalid values" do
25
- [nil, :foobar, 123].wont_be_written_to subject, :f
25
+ _([nil, :foobar, 123]).wont_be_written_to subject, :f
26
26
  end
27
27
 
28
28
  it "accepts valid values" do
29
- [AIXM.f(200, :khz)].must_be_written_to subject, :f
29
+ _([AIXM.f(200, :khz)]).must_be_written_to subject, :f
30
30
  end
31
31
  end
32
32
 
33
33
  describe :kind do
34
34
  it "must return class/type combo" do
35
- subject.kind.must_equal "NDB:B"
35
+ _(subject.kind).must_equal "NDB:B"
36
36
  end
37
37
  end
38
38
 
39
39
  describe :to_xml do
40
40
  it "builds correct complete OFMX" do
41
41
  AIXM.ofmx!
42
- subject.to_xml.must_equal <<~END
42
+ _(subject.to_xml).must_equal <<~END
43
43
  <!-- NavigationalAid: [NDB:B] NNN / NDB NAVAID -->
44
44
  <Ndb source="LF|GEN|0.0 FACTORY|0|0">
45
45
  <NdbUid>
@@ -68,7 +68,7 @@ describe AIXM::Feature::NavigationalAid::NDB do
68
68
  it "builds correct minimal OFMX" do
69
69
  AIXM.ofmx!
70
70
  subject.name = subject.type = subject.z = subject.timetable = subject.remarks = nil
71
- subject.to_xml.must_equal <<~END
71
+ _(subject.to_xml).must_equal <<~END
72
72
  <!-- NavigationalAid: [NDB] NNN -->
73
73
  <Ndb source="LF|GEN|0.0 FACTORY|0|0">
74
74
  <NdbUid>
@@ -85,5 +85,11 @@ describe AIXM::Feature::NavigationalAid::NDB do
85
85
  </Ndb>
86
86
  END
87
87
  end
88
+
89
+ it "builds OFMX with mid" do
90
+ AIXM.ofmx!
91
+ AIXM.config.mid_region = 'LF'
92
+ _(subject.to_xml).must_match /<NdbUid mid="be82074f-4044-8044-5f64-d6080ce3d0e4">/
93
+ end
88
94
  end
89
95
  end
@@ -7,37 +7,37 @@ describe AIXM::Feature::NavigationalAid::TACAN do
7
7
 
8
8
  describe :channel= do
9
9
  it "fails on invalid values" do
10
- [nil, :foobar, 123, '0X', '127Y', '12Z'].wont_be_written_to subject, :channel
10
+ _([nil, :foobar, 123, '0X', '127Y', '12Z']).wont_be_written_to subject, :channel
11
11
  end
12
12
  end
13
13
 
14
14
  describe :ghost_f do
15
15
  it "must be derived from the channel" do
16
- subject.tap { |s| s.channel = '1X' }.ghost_f.freq.must_equal 134.4
17
- subject.tap { |s| s.channel = '12Y' }.ghost_f.freq.must_equal 135.55
18
- subject.tap { |s| s.channel = '16Y' }.ghost_f.freq.must_equal 135.95
19
- subject.tap { |s| s.channel = '17X' }.ghost_f.freq.must_equal 108
20
- subject.tap { |s| s.channel = '30X' }.ghost_f.freq.must_equal 109.3
21
- subject.tap { |s| s.channel = '59Y' }.ghost_f.freq.must_equal 112.25
22
- subject.tap { |s| s.channel = '60X' }.ghost_f.freq.must_equal 133.3
23
- subject.tap { |s| s.channel = '64Y' }.ghost_f.freq.must_equal 133.75
24
- subject.tap { |s| s.channel = '69Y' }.ghost_f.freq.must_equal 134.25
25
- subject.tap { |s| s.channel = '70X' }.ghost_f.freq.must_equal 112.30
26
- subject.tap { |s| s.channel = '100X' }.ghost_f.freq.must_equal 115.3
27
- subject.tap { |s| s.channel = '126Y' }.ghost_f.freq.must_equal 117.95
16
+ _(subject.tap { |s| s.channel = '1X' }.ghost_f.freq).must_equal 134.4
17
+ _(subject.tap { |s| s.channel = '12Y' }.ghost_f.freq).must_equal 135.55
18
+ _(subject.tap { |s| s.channel = '16Y' }.ghost_f.freq).must_equal 135.95
19
+ _(subject.tap { |s| s.channel = '17X' }.ghost_f.freq).must_equal 108
20
+ _(subject.tap { |s| s.channel = '30X' }.ghost_f.freq).must_equal 109.3
21
+ _(subject.tap { |s| s.channel = '59Y' }.ghost_f.freq).must_equal 112.25
22
+ _(subject.tap { |s| s.channel = '60X' }.ghost_f.freq).must_equal 133.3
23
+ _(subject.tap { |s| s.channel = '64Y' }.ghost_f.freq).must_equal 133.75
24
+ _(subject.tap { |s| s.channel = '69Y' }.ghost_f.freq).must_equal 134.25
25
+ _(subject.tap { |s| s.channel = '70X' }.ghost_f.freq).must_equal 112.30
26
+ _(subject.tap { |s| s.channel = '100X' }.ghost_f.freq).must_equal 115.3
27
+ _(subject.tap { |s| s.channel = '126Y' }.ghost_f.freq).must_equal 117.95
28
28
  end
29
29
  end
30
30
 
31
31
  describe :kind do
32
32
  it "must return class/type combo" do
33
- subject.kind.must_equal "TACAN"
33
+ _(subject.kind).must_equal "TACAN"
34
34
  end
35
35
  end
36
36
 
37
37
  describe :to_xml do
38
38
  it "builds correct complete OFMX" do
39
39
  AIXM.ofmx!
40
- subject.to_xml.must_equal <<~END
40
+ _(subject.to_xml).must_equal <<~END
41
41
  <!-- NavigationalAid: [TACAN] TTT / TACAN NAVAID -->
42
42
  <Tcn source="LF|GEN|0.0 FACTORY|0|0">
43
43
  <TcnUid>
@@ -66,7 +66,7 @@ describe AIXM::Feature::NavigationalAid::TACAN do
66
66
  it "builds correct minimal OFMX" do
67
67
  AIXM.ofmx!
68
68
  subject.name = subject.z = subject.timetable = subject.remarks = nil
69
- subject.to_xml.must_equal <<~END
69
+ _(subject.to_xml).must_equal <<~END
70
70
  <!-- NavigationalAid: [TACAN] TTT -->
71
71
  <Tcn source="LF|GEN|0.0 FACTORY|0|0">
72
72
  <TcnUid>
@@ -84,5 +84,11 @@ describe AIXM::Feature::NavigationalAid::TACAN do
84
84
  </Tcn>
85
85
  END
86
86
  end
87
+
88
+ it "builds OFMX with mid" do
89
+ AIXM.ofmx!
90
+ AIXM.config.mid_region = 'LF'
91
+ _(subject.to_xml).must_match /<TcnUid mid="8776071f-114a-4996-84ef-2d7848c503f5">/
92
+ end
87
93
  end
88
94
  end