diff --git a/spec/datastreams/desc_metadata_spec.rb b/spec/datastreams/desc_metadata_spec.rb
index ccc16405..7dc75910 100644
--- a/spec/datastreams/desc_metadata_spec.rb
+++ b/spec/datastreams/desc_metadata_spec.rb
@@ -61,6 +61,13 @@
Topic2: The Interesting Part!
EOF
+ @empty = Dor::DescMetadataDS.from_xml <<-EOF
+
+
+ EOF
end
it 'should get correct values from OM terminology' do
@@ -89,5 +96,15 @@
@partial.abstract = 'Abstract contents.'
expect(@partial.to_xml).to be_equivalent_to(@dsdoc.to_xml)
end
+ it 'should not throw an error when retrieving title_info if titleInfo is missing from the xml' do
+ expect(@empty.title_info.main_title).to eq([])
+ end
+ end
+
+ context 'Behavior of a freshly initialized Datastream' do
+ it 'should not throw an error when retrieving title_info if the datastream object has yet to have XML content set' do
+ desc_md_datastream = Dor::DescMetadataDS.new
+ expect(desc_md_datastream.title_info.main_title).to eq([""])
+ end
end
end