aixm 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +26 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +17 -4
- data/README.md +23 -5
- data/lib/aixm/component/fato.rb +3 -3
- data/lib/aixm/component/frequency.rb +1 -1
- data/lib/aixm/component/geometry/border.rb +9 -3
- data/lib/aixm/component/helipad.rb +1 -1
- data/lib/aixm/component/lighting.rb +1 -1
- data/lib/aixm/component/runway.rb +4 -7
- data/lib/aixm/config.rb +2 -1
- data/lib/aixm/document.rb +1 -0
- data/lib/aixm/feature/address.rb +1 -1
- data/lib/aixm/feature/airport.rb +13 -4
- data/lib/aixm/feature/airspace.rb +11 -8
- data/lib/aixm/feature/navigational_aid/designated_point.rb +1 -1
- data/lib/aixm/feature/navigational_aid/dme.rb +1 -1
- data/lib/aixm/feature/navigational_aid/marker.rb +1 -1
- data/lib/aixm/feature/navigational_aid/ndb.rb +1 -1
- data/lib/aixm/feature/navigational_aid/tacan.rb +1 -1
- data/lib/aixm/feature/navigational_aid/vor.rb +1 -1
- data/lib/aixm/feature/obstacle.rb +1 -1
- data/lib/aixm/feature/obstacle_group.rb +1 -1
- data/lib/aixm/feature/organisation.rb +1 -1
- data/lib/aixm/feature/service.rb +1 -1
- data/lib/aixm/feature/unit.rb +1 -1
- data/lib/aixm/refinements.rb +39 -8
- data/lib/aixm/version.rb +1 -1
- data/rakefile.rb +22 -8
- data/spec/lib/aixm/a_spec.rb +55 -55
- data/spec/lib/aixm/component/fato_spec.rb +30 -23
- data/spec/lib/aixm/component/frequency_spec.rb +12 -13
- data/spec/lib/aixm/component/geometry/arc_spec.rb +7 -9
- data/spec/lib/aixm/component/geometry/border_spec.rb +8 -3
- data/spec/lib/aixm/component/geometry/circle_spec.rb +6 -8
- data/spec/lib/aixm/component/geometry/point_spec.rb +2 -4
- data/spec/lib/aixm/component/geometry_spec.rb +57 -62
- data/spec/lib/aixm/component/helipad_spec.rb +25 -19
- data/spec/lib/aixm/component/layer_spec.rb +17 -19
- data/spec/lib/aixm/component/lighting_spec.rb +21 -15
- data/spec/lib/aixm/component/runway_spec.rb +44 -37
- data/spec/lib/aixm/component/surface_spec.rb +24 -24
- data/spec/lib/aixm/component/timetable_spec.rb +7 -9
- data/spec/lib/aixm/component/vertical_limits_spec.rb +9 -12
- data/spec/lib/aixm/config_spec.rb +8 -8
- data/spec/lib/aixm/d_spec.rb +28 -28
- data/spec/lib/aixm/document_spec.rb +46 -37
- data/spec/lib/aixm/errors_spec.rb +2 -2
- data/spec/lib/aixm/f_spec.rb +16 -16
- data/spec/lib/aixm/feature/address_spec.rb +12 -7
- data/spec/lib/aixm/feature/airport_spec.rb +80 -74
- data/spec/lib/aixm/feature/airspace_spec.rb +32 -28
- data/spec/lib/aixm/feature/navigational_aid/designated_point_spec.rb +16 -11
- data/spec/lib/aixm/feature/navigational_aid/dme_spec.rb +22 -16
- data/spec/lib/aixm/feature/navigational_aid/marker_spec.rb +13 -7
- data/spec/lib/aixm/feature/navigational_aid/ndb_spec.rb +15 -9
- data/spec/lib/aixm/feature/navigational_aid/tacan_spec.rb +22 -16
- data/spec/lib/aixm/feature/navigational_aid/vor_spec.rb +21 -15
- data/spec/lib/aixm/feature/navigational_aid_spec.rb +6 -6
- data/spec/lib/aixm/feature/obstacle_group_spec.rb +25 -21
- data/spec/lib/aixm/feature/obstacle_spec.rb +47 -42
- data/spec/lib/aixm/feature/organisation_spec.rb +16 -10
- data/spec/lib/aixm/feature/service_spec.rb +9 -9
- data/spec/lib/aixm/feature/unit_spec.rb +21 -13
- data/spec/lib/aixm/feature_spec.rb +5 -5
- data/spec/lib/aixm/p_spec.rb +37 -37
- data/spec/lib/aixm/refinements_spec.rb +164 -115
- data/spec/lib/aixm/version_spec.rb +1 -1
- data/spec/lib/aixm/w_spec.rb +28 -28
- data/spec/lib/aixm/xy_spec.rb +34 -34
- data/spec/lib/aixm/z_spec.rb +19 -19
- data/spec/macros/marking.rb +3 -3
- data/spec/macros/organisation.rb +2 -2
- data/spec/macros/remarks.rb +3 -3
- data/spec/macros/timetable.rb +2 -2
- data/spec/macros/xy.rb +2 -2
- data/spec/macros/z_qnh.rb +2 -2
- data/spec/spec_helper.rb +7 -0
- metadata +3 -3
- data/.travis.yml +0 -8
@@ -8,46 +8,46 @@ describe AIXM::Feature::NavigationalAid::VOR do
|
|
8
8
|
|
9
9
|
describe :type= do
|
10
10
|
it "fails on invalid values" do
|
11
|
-
[nil, :foobar, 123].wont_be_written_to subject, :type
|
11
|
+
_([nil, :foobar, 123]).wont_be_written_to subject, :type
|
12
12
|
end
|
13
13
|
|
14
14
|
it "looks up valid values" do
|
15
|
-
subject.tap { |s| s.type = :conventional }.type.must_equal :conventional
|
16
|
-
subject.tap { |s| s.type = :DVOR }.type.must_equal :doppler
|
15
|
+
_(subject.tap { |s| s.type = :conventional }.type).must_equal :conventional
|
16
|
+
_(subject.tap { |s| s.type = :DVOR }.type).must_equal :doppler
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
describe :f= do
|
21
21
|
it "fails on invalid values" do
|
22
|
-
[nil, :foobar, 123].wont_be_written_to subject, :f
|
22
|
+
_([nil, :foobar, 123]).wont_be_written_to subject, :f
|
23
23
|
end
|
24
24
|
|
25
25
|
it "accepts valid values" do
|
26
|
-
[AIXM.f(110, :mhz)].must_be_written_to subject, :f
|
26
|
+
_([AIXM.f(110, :mhz)]).must_be_written_to subject, :f
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
describe :north= do
|
31
31
|
it "fails on invalid values" do
|
32
|
-
[nil, :foobar, 123].wont_be_written_to subject, :north
|
32
|
+
_([nil, :foobar, 123]).wont_be_written_to subject, :north
|
33
33
|
end
|
34
34
|
|
35
35
|
it "looks up valid values" do
|
36
|
-
subject.tap { |s| s.north = :magnetic }.north.must_equal :magnetic
|
37
|
-
subject.tap { |s| s.north = :TRUE }.north.must_equal :geographic
|
36
|
+
_(subject.tap { |s| s.north = :magnetic }.north).must_equal :magnetic
|
37
|
+
_(subject.tap { |s| s.north = :TRUE }.north).must_equal :geographic
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
describe :kind do
|
42
42
|
it "must return class/type combo" do
|
43
|
-
subject.kind.must_equal "VOR:VOR"
|
43
|
+
_(subject.kind).must_equal "VOR:VOR"
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
47
|
describe :to_xml do
|
48
48
|
it "builds correct complete OFMX" do
|
49
49
|
AIXM.ofmx!
|
50
|
-
subject.to_xml.must_equal <<~END
|
50
|
+
_(subject.to_xml).must_equal <<~END
|
51
51
|
<!-- NavigationalAid: [VOR:VOR] VVV / VOR NAVAID -->
|
52
52
|
<Vor source="LF|GEN|0.0 FACTORY|0|0">
|
53
53
|
<VorUid>
|
@@ -77,7 +77,7 @@ describe AIXM::Feature::NavigationalAid::VOR do
|
|
77
77
|
it "builds correct minimal OFMX" do
|
78
78
|
AIXM.ofmx!
|
79
79
|
subject.name = subject.z = subject.timetable = subject.remarks = nil
|
80
|
-
subject.to_xml.must_equal <<~END
|
80
|
+
_(subject.to_xml).must_equal <<~END
|
81
81
|
<!-- NavigationalAid: [VOR:VOR] VVV -->
|
82
82
|
<Vor source="LF|GEN|0.0 FACTORY|0|0">
|
83
83
|
<VorUid>
|
@@ -96,6 +96,12 @@ describe AIXM::Feature::NavigationalAid::VOR do
|
|
96
96
|
</Vor>
|
97
97
|
END
|
98
98
|
end
|
99
|
+
|
100
|
+
it "builds OFMX with mid" do
|
101
|
+
AIXM.ofmx!
|
102
|
+
AIXM.config.mid_region = 'LF'
|
103
|
+
_(subject.to_xml).must_match /<VorUid mid="627bea52-cca8-f407-88be-90a85a333741">/
|
104
|
+
end
|
99
105
|
end
|
100
106
|
end
|
101
107
|
|
@@ -110,14 +116,14 @@ describe AIXM::Feature::NavigationalAid::VOR do
|
|
110
116
|
|
111
117
|
describe :kind do
|
112
118
|
it "must return class/type combo" do
|
113
|
-
subject.kind.must_equal "VOR:VOR"
|
119
|
+
_(subject.kind).must_equal "VOR:VOR"
|
114
120
|
end
|
115
121
|
end
|
116
122
|
|
117
123
|
describe :to_xml do
|
118
124
|
it "builds correct OFMX" do
|
119
125
|
AIXM.ofmx!
|
120
|
-
subject.to_xml.must_equal <<~END
|
126
|
+
_(subject.to_xml).must_equal <<~END
|
121
127
|
<!-- NavigationalAid: [VOR:VOR] VVV / VOR/DME NAVAID -->
|
122
128
|
<Vor source="LF|GEN|0.0 FACTORY|0|0">
|
123
129
|
<VorUid>
|
@@ -182,14 +188,14 @@ describe AIXM::Feature::NavigationalAid::VOR do
|
|
182
188
|
|
183
189
|
describe :kind do
|
184
190
|
it "must return class/type combo" do
|
185
|
-
subject.kind.must_equal "VOR:VOR"
|
191
|
+
_(subject.kind).must_equal "VOR:VOR"
|
186
192
|
end
|
187
193
|
end
|
188
194
|
|
189
195
|
describe :to_xml do
|
190
196
|
it "builds correct OFMX" do
|
191
197
|
AIXM.ofmx!
|
192
|
-
subject.to_xml.must_equal <<~END
|
198
|
+
_(subject.to_xml).must_equal <<~END
|
193
199
|
<!-- NavigationalAid: [VOR:VOR] VVV / VORTAC NAVAID -->
|
194
200
|
<Vor source="LF|GEN|0.0 FACTORY|0|0">
|
195
201
|
<VorUid>
|
@@ -11,25 +11,25 @@ describe AIXM::Feature::NavigationalAid do
|
|
11
11
|
|
12
12
|
describe :id= do
|
13
13
|
it "fails on invalid values" do
|
14
|
-
|
14
|
+
_{ subject.id = 123 }.must_raise ArgumentError
|
15
15
|
end
|
16
16
|
|
17
17
|
it "upcases value" do
|
18
|
-
subject.tap { |s| s.id = 'lol' }.id.must_equal 'LOL'
|
18
|
+
_(subject.tap { |s| s.id = 'lol' }.id).must_equal 'LOL'
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
describe :name= do
|
23
23
|
it "fails on invalid values" do
|
24
|
-
[:foobar, 123].wont_be_written_to subject, :name
|
24
|
+
_([:foobar, 123]).wont_be_written_to subject, :name
|
25
25
|
end
|
26
26
|
|
27
27
|
it "accepts nil value" do
|
28
|
-
[nil].must_be_written_to subject, :name
|
28
|
+
_([nil]).must_be_written_to subject, :name
|
29
29
|
end
|
30
30
|
|
31
31
|
it "upcases and transcodes value" do
|
32
|
-
subject.tap { |s| s.name = 'löl' }.name.must_equal 'LOEL'
|
32
|
+
_(subject.tap { |s| s.name = 'löl' }.name).must_equal 'LOEL'
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -41,7 +41,7 @@ describe AIXM::Feature::NavigationalAid do
|
|
41
41
|
macro :z_qnh
|
42
42
|
|
43
43
|
it "accepts nil value" do
|
44
|
-
[nil].must_be_written_to subject, :z
|
44
|
+
_([nil]).must_be_written_to subject, :z
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -11,37 +11,37 @@ describe AIXM::Feature::ObstacleGroup do
|
|
11
11
|
subject = AIXM.obstacle_group(
|
12
12
|
name: "Mirmande éoliennes"
|
13
13
|
)
|
14
|
-
subject.obstacles.must_equal []
|
14
|
+
_(subject.obstacles).must_equal []
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
describe :name= do
|
19
19
|
it "fails on invalid values" do
|
20
|
-
[:foobar, 123].wont_be_written_to subject, :name
|
20
|
+
_([:foobar, 123]).wont_be_written_to subject, :name
|
21
21
|
end
|
22
22
|
|
23
23
|
it "upcases and transcodes valid values" do
|
24
|
-
subject.name.must_equal 'MIRMANDE EOLIENNES'
|
24
|
+
_(subject.name).must_equal 'MIRMANDE EOLIENNES'
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
describe :xy_accuracy= do
|
29
29
|
it "fails on invalid values" do
|
30
|
-
[:foobar, 123].wont_be_written_to subject, :xy_accuracy
|
30
|
+
_([:foobar, 123]).wont_be_written_to subject, :xy_accuracy
|
31
31
|
end
|
32
32
|
|
33
33
|
it "accepts valid values" do
|
34
|
-
[nil, AIXM::Factory.d, AIXM.d(0, :m)].must_be_written_to subject, :xy_accuracy
|
34
|
+
_([nil, AIXM::Factory.d, AIXM.d(0, :m)]).must_be_written_to subject, :xy_accuracy
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
describe :z_accuracy= do
|
39
39
|
it "fails on invalid values" do
|
40
|
-
[:foobar, 123].wont_be_written_to subject, :z_accuracy
|
40
|
+
_([:foobar, 123]).wont_be_written_to subject, :z_accuracy
|
41
41
|
end
|
42
42
|
|
43
43
|
it "accepts valid values" do
|
44
|
-
[nil, AIXM::Factory.d, AIXM.d(0, :m)].must_be_written_to subject, :z_accuracy
|
44
|
+
_([nil, AIXM::Factory.d, AIXM.d(0, :m)]).must_be_written_to subject, :z_accuracy
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -52,8 +52,8 @@ describe AIXM::Feature::ObstacleGroup do
|
|
52
52
|
describe :add_obstacle do
|
53
53
|
it "adds an obstacle to the obstacle group" do
|
54
54
|
subject.add_obstacle(AIXM::Factory.obstacle)
|
55
|
-
subject.obstacles.count.must_equal 1
|
56
|
-
subject.obstacles.first.obstacle_group.must_equal subject
|
55
|
+
_(subject.obstacles.count).must_equal 1
|
56
|
+
_(subject.obstacles.first.obstacle_group).must_equal subject
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -63,8 +63,7 @@ describe AIXM::Feature::ObstacleGroup do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
it "builds correct AIXM" do
|
66
|
-
|
67
|
-
subject.to_xml.must_equal <<~END
|
66
|
+
_(subject.to_xml).must_equal <<~END
|
68
67
|
<!-- Obstacle: [wind_turbine] 44.67501389N 004.87256667E LA TEISSONIERE 1 -->
|
69
68
|
<Obs>
|
70
69
|
<ObsUid>
|
@@ -106,7 +105,7 @@ describe AIXM::Feature::ObstacleGroup do
|
|
106
105
|
|
107
106
|
it "builds correct OFMX" do
|
108
107
|
AIXM.ofmx!
|
109
|
-
subject.to_xml.must_equal <<~END
|
108
|
+
_(subject.to_xml).must_equal <<~END
|
110
109
|
<!-- Obstacle group: MIRMANDE EOLIENNES -->
|
111
110
|
<Ogr>
|
112
111
|
<OgrUid>
|
@@ -171,6 +170,12 @@ describe AIXM::Feature::ObstacleGroup do
|
|
171
170
|
</Obs>
|
172
171
|
END
|
173
172
|
end
|
173
|
+
|
174
|
+
it "builds OFMX with mid" do
|
175
|
+
AIXM.ofmx!
|
176
|
+
AIXM.config.mid_region = 'LF'
|
177
|
+
_(subject.to_xml).must_match /<OgrUid mid="c099ea7c-2056-3921-5c1c-b28090537332">/
|
178
|
+
end
|
174
179
|
end
|
175
180
|
end
|
176
181
|
|
@@ -183,17 +188,17 @@ describe AIXM::Feature::ObstacleGroup do
|
|
183
188
|
it "adds an obstacle to the obstacle group and links it to previous" do
|
184
189
|
subject.add_obstacle(AIXM::Factory.obstacle)
|
185
190
|
subject.add_obstacle(AIXM::Factory.obstacle, linked_to: :previous, link_type: :cable)
|
186
|
-
subject.obstacles.count.must_equal 2
|
187
|
-
subject.obstacles.last.linked_to.must_equal subject.obstacles.first
|
188
|
-
subject.obstacles.last.link_type.must_equal :cable
|
191
|
+
_(subject.obstacles.count).must_equal 2
|
192
|
+
_(subject.obstacles.last.linked_to).must_equal subject.obstacles.first
|
193
|
+
_(subject.obstacles.last.link_type).must_equal :cable
|
189
194
|
end
|
190
195
|
|
191
196
|
it "adds an obstacle to the obstacle group and links it to another obstacle" do
|
192
197
|
subject.add_obstacle(AIXM::Factory.obstacle)
|
193
198
|
subject.add_obstacle(AIXM::Factory.obstacle, linked_to: subject.obstacles.first, link_type: :solid)
|
194
|
-
subject.obstacles.count.must_equal 2
|
195
|
-
subject.obstacles.last.linked_to.must_equal subject.obstacles.first
|
196
|
-
subject.obstacles.last.link_type.must_equal :solid
|
199
|
+
_(subject.obstacles.count).must_equal 2
|
200
|
+
_(subject.obstacles.last.linked_to).must_equal subject.obstacles.first
|
201
|
+
_(subject.obstacles.last.link_type).must_equal :solid
|
197
202
|
end
|
198
203
|
end
|
199
204
|
|
@@ -203,8 +208,7 @@ describe AIXM::Feature::ObstacleGroup do
|
|
203
208
|
end
|
204
209
|
|
205
210
|
it "builds correct AIXM" do
|
206
|
-
|
207
|
-
subject.to_xml.must_equal <<~END
|
211
|
+
_(subject.to_xml).must_equal <<~END
|
208
212
|
<!-- Obstacle: [mast] 52.29639722N 002.10675278W DROITWICH LW NORTH -->
|
209
213
|
<Obs>
|
210
214
|
<ObsUid>
|
@@ -246,7 +250,7 @@ describe AIXM::Feature::ObstacleGroup do
|
|
246
250
|
|
247
251
|
it "builds correct OFMX" do
|
248
252
|
AIXM.ofmx!
|
249
|
-
subject.to_xml.must_equal <<~END
|
253
|
+
_(subject.to_xml).must_equal <<~END
|
250
254
|
<!-- Obstacle group: DROITWICH LONGWAVE ANTENNA -->
|
251
255
|
<Ogr>
|
252
256
|
<OgrUid>
|
@@ -13,30 +13,30 @@ describe AIXM::Feature::Obstacle do
|
|
13
13
|
radius: AIXM.d(88, :m),
|
14
14
|
z: AIXM.z(1187 , :qnh)
|
15
15
|
)
|
16
|
-
subject.wont_be :lighting
|
17
|
-
subject.wont_be :marking
|
18
|
-
subject.wont_be :height_accurate
|
16
|
+
_(subject).wont_be :lighting
|
17
|
+
_(subject).wont_be :marking
|
18
|
+
_(subject).wont_be :height_accurate
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
describe :name= do
|
23
23
|
it "fails on invalid values" do
|
24
|
-
[:foobar, 123].wont_be_written_to subject, :name
|
24
|
+
_([:foobar, 123]).wont_be_written_to subject, :name
|
25
25
|
end
|
26
26
|
|
27
27
|
it "upcases and transcodes valid values" do
|
28
|
-
subject.tap { |s| s.name = 'Teufelsbrücke' }.name.must_equal 'TEUFELSBRUECKE'
|
28
|
+
_(subject.tap { |s| s.name = 'Teufelsbrücke' }.name).must_equal 'TEUFELSBRUECKE'
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
describe :type= do
|
33
33
|
it "fails on invalid values" do
|
34
|
-
[nil, :foobar].wont_be_written_to subject, :type
|
34
|
+
_([nil, :foobar]).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 = :WINDTURBINE }.type.must_equal :wind_turbine
|
39
|
-
subject.tap { |s| s.type = :TOWER }.type.must_equal :tower
|
38
|
+
_(subject.tap { |s| s.type = :WINDTURBINE }.type).must_equal :wind_turbine
|
39
|
+
_(subject.tap { |s| s.type = :TOWER }.type).must_equal :tower
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -44,17 +44,17 @@ describe AIXM::Feature::Obstacle do
|
|
44
44
|
macro :xy
|
45
45
|
|
46
46
|
it "fails on nil values" do
|
47
|
-
[nil].wont_be_written_to subject, :xy
|
47
|
+
_([nil]).wont_be_written_to subject, :xy
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
51
|
describe :radius= do
|
52
52
|
it "fails on invalid values" do
|
53
|
-
[:foobar, 123, AIXM.d(0, :m)].wont_be_written_to subject, :radius
|
53
|
+
_([:foobar, 123, AIXM.d(0, :m)]).wont_be_written_to subject, :radius
|
54
54
|
end
|
55
55
|
|
56
56
|
it "accepts valid values" do
|
57
|
-
[AIXM::Factory.d, nil].must_be_written_to subject, :radius
|
57
|
+
_([AIXM::Factory.d, nil]).must_be_written_to subject, :radius
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -62,119 +62,119 @@ describe AIXM::Feature::Obstacle do
|
|
62
62
|
macro :z_qnh
|
63
63
|
|
64
64
|
it "fails on nil values" do
|
65
|
-
[nil].wont_be_written_to subject, :z
|
65
|
+
_([nil]).wont_be_written_to subject, :z
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
69
|
describe :lighting= do
|
70
70
|
it "fails on invalid values" do
|
71
|
-
[:foobar, 123].wont_be_written_to subject, :lighting
|
71
|
+
_([:foobar, 123]).wont_be_written_to subject, :lighting
|
72
72
|
end
|
73
73
|
|
74
74
|
it "accepts valid values" do
|
75
|
-
[true, false, nil].must_be_written_to subject, :lighting
|
75
|
+
_([true, false, nil]).must_be_written_to subject, :lighting
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
79
|
describe :lighting_remarks= do
|
80
80
|
it "accepts nil value" do
|
81
|
-
[nil].must_be_written_to subject, :lighting_remarks
|
81
|
+
_([nil]).must_be_written_to subject, :lighting_remarks
|
82
82
|
end
|
83
83
|
|
84
84
|
it "stringifies valid values" do
|
85
|
-
subject.tap { |s| s.lighting_remarks = 'foobar' }.lighting_remarks.must_equal 'foobar'
|
86
|
-
subject.tap { |s| s.lighting_remarks = 123 }.lighting_remarks.must_equal '123'
|
85
|
+
_(subject.tap { |s| s.lighting_remarks = 'foobar' }.lighting_remarks).must_equal 'foobar'
|
86
|
+
_(subject.tap { |s| s.lighting_remarks = 123 }.lighting_remarks).must_equal '123'
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
90
|
describe :marking= do
|
91
91
|
it "fails on invalid values" do
|
92
|
-
[:foobar, 123].wont_be_written_to subject, :marking
|
92
|
+
_([:foobar, 123]).wont_be_written_to subject, :marking
|
93
93
|
end
|
94
94
|
|
95
95
|
it "accepts valid values" do
|
96
|
-
[true, false, nil].must_be_written_to subject, :marking
|
96
|
+
_([true, false, nil]).must_be_written_to subject, :marking
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
100
|
describe :marking_remarks= do
|
101
101
|
it "accepts nil value" do
|
102
|
-
[nil].must_be_written_to subject, :marking_remarks
|
102
|
+
_([nil]).must_be_written_to subject, :marking_remarks
|
103
103
|
end
|
104
104
|
|
105
105
|
it "stringifies valid values" do
|
106
|
-
subject.tap { |s| s.marking_remarks = 'foobar' }.marking_remarks.must_equal 'foobar'
|
107
|
-
subject.tap { |s| s.marking_remarks = 123 }.marking_remarks.must_equal '123'
|
106
|
+
_(subject.tap { |s| s.marking_remarks = 'foobar' }.marking_remarks).must_equal 'foobar'
|
107
|
+
_(subject.tap { |s| s.marking_remarks = 123 }.marking_remarks).must_equal '123'
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
111
|
describe :height= do
|
112
112
|
it "fails on invalid values" do
|
113
|
-
[:foobar, 123, AIXM.d(0, :m)].wont_be_written_to subject, :height
|
113
|
+
_([:foobar, 123, AIXM.d(0, :m)]).wont_be_written_to subject, :height
|
114
114
|
end
|
115
115
|
|
116
116
|
it "accepts valid values" do
|
117
|
-
[nil, AIXM::Factory.d].must_be_written_to subject, :height
|
117
|
+
_([nil, AIXM::Factory.d]).must_be_written_to subject, :height
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
121
121
|
describe :xy_accuracy= do
|
122
122
|
it "fails on invalid values" do
|
123
|
-
[:foobar, 123].wont_be_written_to subject, :xy_accuracy
|
123
|
+
_([:foobar, 123]).wont_be_written_to subject, :xy_accuracy
|
124
124
|
end
|
125
125
|
|
126
126
|
it "accepts valid values" do
|
127
|
-
[nil, AIXM::Factory.d, AIXM.d(0, :m)].must_be_written_to subject, :xy_accuracy
|
127
|
+
_([nil, AIXM::Factory.d, AIXM.d(0, :m)]).must_be_written_to subject, :xy_accuracy
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
131
|
describe :z_accuracy= do
|
132
132
|
it "fails on invalid values" do
|
133
|
-
[:foobar, 123].wont_be_written_to subject, :z_accuracy
|
133
|
+
_([:foobar, 123]).wont_be_written_to subject, :z_accuracy
|
134
134
|
end
|
135
135
|
|
136
136
|
it "accepts valid values" do
|
137
|
-
[nil, AIXM::Factory.d, AIXM.d(0, :m)].must_be_written_to subject, :z_accuracy
|
137
|
+
_([nil, AIXM::Factory.d, AIXM.d(0, :m)]).must_be_written_to subject, :z_accuracy
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
141
141
|
describe :height_accurate= do
|
142
142
|
it "fails on invalid values" do
|
143
|
-
[:foobar, 123].wont_be_written_to subject, :height_accurate
|
143
|
+
_([:foobar, 123]).wont_be_written_to subject, :height_accurate
|
144
144
|
end
|
145
145
|
|
146
146
|
it "accepts valid values" do
|
147
|
-
[true, false, nil].must_be_written_to subject, :height_accurate
|
147
|
+
_([true, false, nil]).must_be_written_to subject, :height_accurate
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
151
151
|
describe :valid_from= do
|
152
152
|
it "fails on invalid values" do
|
153
|
-
['foobar', '2018-01-77'].wont_be_written_to subject, :valid_from
|
153
|
+
_(['foobar', '2018-01-77']).wont_be_written_to subject, :valid_from
|
154
154
|
end
|
155
155
|
|
156
156
|
it "accepts nil value" do
|
157
|
-
[nil].must_be_written_to subject, :valid_from
|
157
|
+
_([nil]).must_be_written_to subject, :valid_from
|
158
158
|
end
|
159
159
|
|
160
160
|
it "parses dates and times" do
|
161
161
|
string = '2018-01-01 12:00:00 +0100'
|
162
|
-
subject.tap { |s| s.valid_from = string }.valid_from.must_equal Time.parse(string)
|
162
|
+
_(subject.tap { |s| s.valid_from = string }.valid_from).must_equal Time.parse(string)
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
166
166
|
describe :valid_until= do
|
167
167
|
it "fails on invalid values" do
|
168
|
-
['foobar', '2018-01-77'].wont_be_written_to subject, :valid_until
|
168
|
+
_(['foobar', '2018-01-77']).wont_be_written_to subject, :valid_until
|
169
169
|
end
|
170
170
|
|
171
171
|
it "accepts nil value" do
|
172
|
-
[nil].must_be_written_to subject, :valid_until
|
172
|
+
_([nil]).must_be_written_to subject, :valid_until
|
173
173
|
end
|
174
174
|
|
175
175
|
it "parses dates and times" do
|
176
176
|
string = '2018-01-01 12:00:00 +0100'
|
177
|
-
subject.tap { |s| s.valid_until = string }.valid_until.must_equal Time.parse(string)
|
177
|
+
_(subject.tap { |s| s.valid_until = string }.valid_until).must_equal Time.parse(string)
|
178
178
|
end
|
179
179
|
end
|
180
180
|
|
@@ -184,7 +184,7 @@ describe AIXM::Feature::Obstacle do
|
|
184
184
|
|
185
185
|
describe :grouped? do
|
186
186
|
it "returns false since single obstacles are not grouped" do
|
187
|
-
subject.wont_be :grouped?
|
187
|
+
_(subject).wont_be :grouped?
|
188
188
|
end
|
189
189
|
end
|
190
190
|
|
@@ -194,19 +194,18 @@ describe AIXM::Feature::Obstacle do
|
|
194
194
|
end
|
195
195
|
|
196
196
|
it "returns false for unlinked obstacles" do
|
197
|
-
subject.wont_be :linked?
|
197
|
+
_(subject).wont_be :linked?
|
198
198
|
end
|
199
199
|
|
200
200
|
it "returns true for linked obstacles" do
|
201
201
|
subject = AIXM::Factory.linked_obstacle_group.obstacles.last
|
202
|
-
subject.must_be :linked?
|
202
|
+
_(subject).must_be :linked?
|
203
203
|
end
|
204
204
|
end
|
205
205
|
|
206
206
|
describe :to_xml do
|
207
207
|
it "builds correct AIXM" do
|
208
|
-
|
209
|
-
subject.to_xml.must_equal <<~END
|
208
|
+
_(subject.to_xml).must_equal <<~END
|
210
209
|
<!-- Obstacle: [tower] 48.85825000N 002.29458889E EIFFEL TOWER -->
|
211
210
|
<Obs>
|
212
211
|
<ObsUid>
|
@@ -232,7 +231,7 @@ describe AIXM::Feature::Obstacle do
|
|
232
231
|
|
233
232
|
it "builds correct OFMX" do
|
234
233
|
AIXM.ofmx!
|
235
|
-
subject.to_xml.must_equal <<~END
|
234
|
+
_(subject.to_xml).must_equal <<~END
|
236
235
|
<!-- Obstacle group: EIFFEL TOWER -->
|
237
236
|
<Ogr>
|
238
237
|
<OgrUid>
|
@@ -275,5 +274,11 @@ describe AIXM::Feature::Obstacle do
|
|
275
274
|
</Obs>
|
276
275
|
END
|
277
276
|
end
|
277
|
+
|
278
|
+
it "builds OFMX with mid" do
|
279
|
+
AIXM.ofmx!
|
280
|
+
AIXM.config.mid_region = 'LF'
|
281
|
+
_(subject.to_xml).must_match /<ObsUid mid="864b252b-0b1d-66c4-22cd-14dbda287467">/
|
282
|
+
end
|
278
283
|
end
|
279
284
|
end
|