spec/unit/datacite/mapping/nonvalidating/identifier_spec.rb in datacite-mapping-0.1.17.1 vs spec/unit/datacite/mapping/nonvalidating/identifier_spec.rb in datacite-mapping-0.1.17.2
- old
+ new
@@ -2,9 +2,23 @@
module Datacite
module Mapping
module Nonvalidating
describe Identifier do
+
+ describe '#new' do
+ it 'accepts a nil value' do
+ id = Identifier.new(value: nil)
+ expect(id.identifier_type).to eq('DOI')
+ end
+
+ it 'accepts an invalid value' do
+ id = Identifier.new(value: 'elvis')
+ expect(id.value).to eq('elvis')
+ end
+
+ end
+
describe '#load_from_xml' do
it 'parses a valid identifier' do
xml_text = "<identifier identifierType='DOI'>10.14749/1407399498</identifier>"
id = Identifier.parse_xml(xml_text, mapping: :nonvalidating)
expect(id.identifier_type).to eq('DOI')