require_relative '../../../../spec_helper'
describe AIXM::Feature::NavigationalAid::Marker do
subject do
AIXM::Factory.marker
end
describe :type= do
it "fails on invalid values" do
[:foobar, 123].wont_be_written_to subject, :type
end
it "accepts nil value" do
[nil].must_be_written_to subject, :name
end
it "looks up valid values" do
subject.tap { |s| s.type = :middle }.type.must_equal :middle
subject.tap { |s| s.type = :O }.type.must_equal :outer
end
end
describe :kind do
it "must return class/type combo" do
subject.kind.must_equal "Marker:O"
end
end
describe :to_xml do
it "builds correct complete OFMX" do
AIXM.ofmx!
subject.to_xml.must_equal <<~END
---
47.85916667N
007.56000000E
FRANCE
O
75
MHZ
MARKER NAVAID
WGE
500
FT
H24
marker navaid
END
end
it "builds correct minimal OFMX" do
AIXM.ofmx!
subject.type = subject.name = subject.z = subject.timetable = subject.remarks = nil
subject.to_xml.must_equal <<~END
---
47.85916667N
007.56000000E
FRANCE
75
MHZ
WGE
END
end
end
end