spec/unit/datacite/mapping/description_spec.rb in datacite-mapping-0.1.17.2 vs spec/unit/datacite/mapping/description_spec.rb in datacite-mapping-0.2.0
- old
+ new
@@ -1,10 +1,11 @@
require 'spec_helper'
module Datacite
module Mapping
describe Description do
+
describe '#load_from_xml' do
it 'reads XML' do
xml_text = '<description xml:lang="en-us" descriptionType="Abstract">
XML example of all DataCite Metadata Schema v3.1 properties.
</description>'
@@ -14,11 +15,11 @@
expected_type = DescriptionType::ABSTRACT
expected_value = 'XML example of all DataCite Metadata Schema v3.1 properties.'
expect(desc.language).to eq(expected_lang)
expect(desc.type).to eq(expected_type)
- expect(desc.value.strip).to eq(expected_value)
+ expect(desc.value).to eq(expected_value)
end
it 'handles escaped HTML' do
xml_text = '<description xml:lang="en-us" descriptionType="Abstract">
<p>This is HTML text</p><p><small>despite the advice in the standard</small></p>
@@ -53,15 +54,15 @@
expected_xml = '<description xml:lang="en-us" descriptionType="Abstract">foo</description>'
expect(desc.save_to_xml).to be_xml(expected_xml)
end
it 'escapes HTML' do
desc = Description.new(type: DescriptionType::ABSTRACT, value: '<p>This is HTML text</p>')
- expected_xml = '<description xml:lang="en" descriptionType="Abstract"><p>This is HTML text</p></description>'
+ expected_xml = '<description descriptionType="Abstract"><p>This is HTML text</p></description>'
expect(desc.save_to_xml).to be_xml(expected_xml)
end
it 'preserves <br/> and <br></br> tags' do
desc = Description.new(type: DescriptionType::ABSTRACT, value: '<br/> <br/> abstract <br></br> full <br /> of <br> </br>s')
- expected_xml = '<description xml:lang="en" descriptionType="Abstract"><br/> &lt;br/&gt; abstract <br/> full <br/> of <br/>s</description>'
+ expected_xml = '<description descriptionType="Abstract"><br/> &lt;br/&gt; abstract <br/> full <br/> of <br/>s</description>'
expect(desc.save_to_xml).to be_xml(expected_xml)
end
end
it 'round-trips to XML' do