require_relative '../../../spec_helper'
describe AIXM::Feature::Airspace do
context "incomplete" do
subject do
AIXM::Feature::Airspace.new(name: 'foobar', type: 'D')
end
describe :valid? do
it "must fail validation" do
subject.wont_be :valid?
end
end
describe :vertical_limits= do
it "won't accept invalid vertical limits" do
-> { subject.vertical_limits=0 }.must_raise ArgumentError
end
end
end
context "complete" do
subject do
AIXM::Factory.polygon_airspace
end
describe :valid? do
it "must pass validation" do
subject.must_be :valid?
end
end
describe :to_digest do
it "must return digest of payload" do
subject.to_digest.must_equal '7F466CA0'
end
end
describe :to_xml do
it "must build correct XML with OFM extensions" do
subject.to_xml(:OFM).must_equal <<~END
D
7F466CA0
POLYGON AIRSPACE
STD
65
FL
STD
45
FL
ALT
6000
FT
HEI
3000
FT
polygon airspace
polygon airspace
false
D
7F466CA0
CWA
475133.00N
0073336.00E
WGE
475415.00N
0073348.00E
FNT
475637.00N
0073545.00E
WGE
GRC
475133.00N
0073336.00E
WGE
END
end
end
end
end