spec/lib/aixm/feature/airspace_spec.rb in aixm-0.3.0 vs spec/lib/aixm/feature/airspace_spec.rb in aixm-0.3.1
- old
+ new
@@ -7,23 +7,23 @@
AIXM.airspace(type: "TMA", name: "Test TMA")
end
describe :initialize do
it "sets defaults" do
- subject.id.must_equal '22E2F734'
+ subject.id.must_equal 'C55466EC'
subject.layers.must_equal []
subject.geometry.must_be_instance_of AIXM::Component::Geometry
end
end
describe :id= do
it "fails on invalid values" do
[:foobar, 123].wont_be_written_to subject, :id
end
- it "falls back to id derived from digest of id, name and short_name" do
- subject.tap { |s| s.id = nil }.id.must_equal '22E2F734'
+ it "falls back to id derived from digest of type, local_type and name" do
+ subject.tap { |s| s.id = nil }.id.must_equal 'C55466EC'
end
it "upcases value" do
subject.tap { |s| s.id = 'löl' }.id.must_equal 'LOEL'
end
@@ -38,35 +38,35 @@
subject.tap { |s| s.type = :danger_area }.type.must_equal :danger_area
subject.tap { |s| s.type = :P }.type.must_equal :prohibited_area
end
end
- describe :name= do
+ describe :local_type= do
it "fails on invalid values" do
- [:foobar, 123].wont_be_written_to subject, :name
+ [:foobar, 123].wont_be_written_to subject, :local_type
end
it "accepts nil value" do
- [nil].must_be_written_to subject, :name
+ [nil].must_be_written_to subject, :local_type
end
it "upcases value" do
- subject.tap { |s| s.name = 'löl' }.name.must_equal 'LOEL'
+ subject.tap { |s| s.local_type = 'löl' }.local_type.must_equal 'LOEL'
end
end
- describe :short_name= do
+ describe :name= do
it "fails on invalid values" do
- [:foobar, 123].wont_be_written_to subject, :short_name
+ [:foobar, 123].wont_be_written_to subject, :name
end
it "accepts nil value" do
- [nil].must_be_written_to subject, :short_name
+ [nil].must_be_written_to subject, :name
end
it "upcases value" do
- subject.tap { |s| s.short_name = 'löl' }.short_name.must_equal 'LOEL'
+ subject.tap { |s| s.name = 'löl' }.name.must_equal 'LOEL'
end
end
describe :to_uid do
it "builds with arbitrary tag" do
@@ -97,11 +97,11 @@
end
describe :to_xml do
it "builds correct AIXM without id" do
AIXM.aixm!
- subject.to_xml.must_match(%r{<codeId>22E2F734</codeId>})
+ subject.to_xml.must_match(%r{<codeId>C55466EC</codeId>})
end
it "builds correct AIXM without short name" do
AIXM.aixm!
subject.to_xml.wont_match(/<txtLocalType>/)
@@ -123,17 +123,19 @@
it "builds correct complete OFMX" do
AIXM.ofmx!
subject.to_xml.must_equal <<~"END"
<!-- Airspace: [D] POLYGON AIRSPACE -->
<Ase source="LF|GEN|0.0 FACTORY|0|0">
- <AseUid region="LF">
+ <AseUid>
<codeType>D</codeType>
<codeId>PA</codeId>
</AseUid>
<txtLocalType>POLYGON</txtLocalType>
<txtName>POLYGON AIRSPACE</txtName>
<codeClass>C</codeClass>
+ <codeLocInd>XXXX</codeLocInd>
+ <codeActivity>TFC-AD</codeActivity>
<codeDistVerUpper>STD</codeDistVerUpper>
<valDistVerUpper>65</valDistVerUpper>
<uomDistVerUpper>FL</uomDistVerUpper>
<codeDistVerLower>STD</codeDistVerLower>
<valDistVerLower>45</valDistVerLower>
@@ -150,11 +152,11 @@
<codeSelAvbl>Y</codeSelAvbl>
<txtRmk>airspace layer</txtRmk>
</Ase>
<Abd>
<AbdUid>
- <AseUid region="LF">
+ <AseUid>
<codeType>D</codeType>
<codeId>PA</codeId>
</AseUid>
</AbdUid>
<Avx>
@@ -184,19 +186,21 @@
END
end
it "builds correct minimal OFMX" do
AIXM.ofmx!
- subject.short_name = subject.name = nil
+ subject.local_type = subject.name = nil
subject.to_xml.must_equal <<~"END"
<!-- Airspace: [D] UNNAMED -->
<Ase source="LF|GEN|0.0 FACTORY|0|0">
- <AseUid region="LF">
+ <AseUid>
<codeType>D</codeType>
<codeId>PA</codeId>
</AseUid>
<codeClass>C</codeClass>
+ <codeLocInd>XXXX</codeLocInd>
+ <codeActivity>TFC-AD</codeActivity>
<codeDistVerUpper>STD</codeDistVerUpper>
<valDistVerUpper>65</valDistVerUpper>
<uomDistVerUpper>FL</uomDistVerUpper>
<codeDistVerLower>STD</codeDistVerLower>
<valDistVerLower>45</valDistVerLower>
@@ -213,11 +217,11 @@
<codeSelAvbl>Y</codeSelAvbl>
<txtRmk>airspace layer</txtRmk>
</Ase>
<Abd>
<AbdUid>
- <AseUid region="LF">
+ <AseUid>
<codeType>D</codeType>
<codeId>PA</codeId>
</AseUid>
</AbdUid>
<Avx>
@@ -259,21 +263,21 @@
describe :to_xml do
it "builds correct OFMX" do
AIXM.ofmx!
subject.to_xml.must_equal <<~"END"
<!-- Airspace: [D] POLYGON AIRSPACE -->
- <Ase source="LF|GEN|0.0 FACTORY|0|0" classLayers="2">
- <AseUid region="LF">
+ <Ase source="LF|GEN|0.0 FACTORY|0|0">
+ <AseUid>
<codeType>D</codeType>
<codeId>PA</codeId>
</AseUid>
<txtLocalType>POLYGON</txtLocalType>
<txtName>POLYGON AIRSPACE</txtName>
</Ase>
<Abd>
<AbdUid>
- <AseUid region="LF">
+ <AseUid>
<codeType>D</codeType>
<codeId>PA</codeId>
</AseUid>
</AbdUid>
<Avx>
@@ -299,16 +303,18 @@
<geoLong>007.56000000E</geoLong>
<codeDatum>WGE</codeDatum>
</Avx>
</Abd>
<Ase>
- <AseUid region="LF">
+ <AseUid>
<codeType>CLASS</codeType>
- <codeId>522496D6</codeId>
+ <codeId>B794588D</codeId>
</AseUid>
<txtName>POLYGON AIRSPACE LAYER 1</txtName>
<codeClass>C</codeClass>
+ <codeLocInd>XXXX</codeLocInd>
+ <codeActivity>TFC-AD</codeActivity>
<codeDistVerUpper>STD</codeDistVerUpper>
<valDistVerUpper>65</valDistVerUpper>
<uomDistVerUpper>FL</uomDistVerUpper>
<codeDistVerLower>STD</codeDistVerLower>
<valDistVerLower>45</valDistVerLower>
@@ -325,27 +331,29 @@
<codeSelAvbl>Y</codeSelAvbl>
<txtRmk>airspace layer</txtRmk>
</Ase>
<Adg>
<AdgUid>
- <AseUid region="LF">
+ <AseUid>
<codeType>CLASS</codeType>
- <codeId>522496D6</codeId>
+ <codeId>B794588D</codeId>
</AseUid>
</AdgUid>
- <AseUidSameExtent region="LF">
+ <AseUidSameExtent>
<codeType>D</codeType>
<codeId>PA</codeId>
</AseUidSameExtent>
</Adg>
<Ase>
- <AseUid region="LF">
+ <AseUid>
<codeType>CLASS</codeType>
- <codeId>CAA85949</codeId>
+ <codeId>64589EAF</codeId>
</AseUid>
<txtName>POLYGON AIRSPACE LAYER 2</txtName>
<codeClass>C</codeClass>
+ <codeLocInd>XXXX</codeLocInd>
+ <codeActivity>TFC-AD</codeActivity>
<codeDistVerUpper>STD</codeDistVerUpper>
<valDistVerUpper>65</valDistVerUpper>
<uomDistVerUpper>FL</uomDistVerUpper>
<codeDistVerLower>STD</codeDistVerLower>
<valDistVerLower>45</valDistVerLower>
@@ -362,15 +370,15 @@
<codeSelAvbl>Y</codeSelAvbl>
<txtRmk>airspace layer</txtRmk>
</Ase>
<Adg>
<AdgUid>
- <AseUid region="LF">
+ <AseUid>
<codeType>CLASS</codeType>
- <codeId>CAA85949</codeId>
+ <codeId>64589EAF</codeId>
</AseUid>
</AdgUid>
- <AseUidSameExtent region="LF">
+ <AseUidSameExtent>
<codeType>D</codeType>
<codeId>PA</codeId>
</AseUidSameExtent>
</Adg>
END