spec/lib/aixm/feature/organisation_spec.rb in aixm-0.3.7 vs spec/lib/aixm/feature/organisation_spec.rb in aixm-0.3.8
- old
+ new
@@ -5,51 +5,51 @@
AIXM::Factory.organisation
end
describe :name= do
it "fails on invalid values" do
- [nil, :foobar, 123].wont_be_written_to subject, :name
+ _([nil, :foobar, 123]).wont_be_written_to subject, :name
end
it "upcases and transcodes valid values" do
- subject.tap { |s| s.name = 'Nîmes-Alès' }.name.must_equal 'NIMES-ALES'
+ _(subject.tap { |s| s.name = 'Nîmes-Alès' }.name).must_equal 'NIMES-ALES'
end
end
describe :type= do
it "fails on invalid values" do
- [nil, :foobar, 123].wont_be_written_to subject, :type
+ _([nil, :foobar, 123]).wont_be_written_to subject, :type
end
it "looks up valid values" do
- subject.tap { |s| s.type = :state }.type.must_equal :state
- subject.tap { |s| s.type = :IO }.type.must_equal :international_organisation
+ _(subject.tap { |s| s.type = :state }.type).must_equal :state
+ _(subject.tap { |s| s.type = :IO }.type).must_equal :international_organisation
end
end
describe :id= do
it "fails on invalid values" do
- [:foobar, 123].wont_be_written_to subject, :id
+ _([:foobar, 123]).wont_be_written_to subject, :id
end
it "accepts nil value" do
- [nil].must_be_written_to subject, :id
+ _([nil]).must_be_written_to subject, :id
end
it "upcases valid values" do
- subject.tap { |s| s.id = 'lf' }.id.must_equal 'LF'
+ _(subject.tap { |s| s.id = 'lf' }.id).must_equal 'LF'
end
end
describe :remarks= do
macro :remarks
end
describe :to_xml do
it "builds correct complete OFMX" do
AIXM.ofmx!
- subject.to_xml.must_equal <<~END
+ _(subject.to_xml).must_equal <<~END
<!-- Organisation: FRANCE -->
<Org source="LF|GEN|0.0 FACTORY|0|0">
<OrgUid>
<txtName>FRANCE</txtName>
</OrgUid>
@@ -61,17 +61,23 @@
end
it "builds correct minimal OFMX" do
AIXM.ofmx!
subject.id = subject.remarks = nil
- subject.to_xml.must_equal <<~END
+ _(subject.to_xml).must_equal <<~END
<!-- Organisation: FRANCE -->
<Org source="LF|GEN|0.0 FACTORY|0|0">
<OrgUid>
<txtName>FRANCE</txtName>
</OrgUid>
<codeType>S</codeType>
</Org>
END
+ end
+
+ it "builds OFMX with mid" do
+ AIXM.ofmx!
+ AIXM.config.mid_region = 'LF'
+ _(subject.to_xml).must_match /<OrgUid mid="b5fef8e2-ea45-7326-6b2f-38cb45cd21a8">/
end
end
end