spec/unit/datacite/mapping/identifier_spec.rb in datacite-mapping-0.2.5 vs spec/unit/datacite/mapping/identifier_spec.rb in datacite-mapping-0.3.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require 'spec_helper'
module Datacite
module Mapping
describe Identifier do
@@ -19,17 +21,17 @@
id = Identifier.new(value: '10.14749/1407399495')
expect(id.identifier_type).to eq('DOI')
end
it 'disallows bad DOIs' do
- bad_dois = %w(
+ bad_dois = %w[
20.14749/1407399495
11.14749/1407399495
10./1407399495
10.14749\1407399495
10.14749/
- )
+ ]
bad_dois.each do |doi|
expect { Identifier.new(value: doi) }.to raise_error(ArgumentError)
end
end
@@ -69,17 +71,17 @@
expect(id.value).to eq(doi_value)
expect(id.identifier_type).to eq('DOI')
end
it 'raises ArgumentError if it is passed a bad DOI' do
- bad_dois = %w(
+ bad_dois = %w[
20.14749/1407399495
11.14749/1407399495
10./1407399495
10.14749\1407399495
10.14749/
- )
+ ]
bad_dois.each do |doi|
expect { Identifier.from_doi(doi) }.to raise_error do |e|
expect(e).to be_an(ArgumentError)
expect(e.message).to include(doi)
end
@@ -93,16 +95,16 @@
id.value = '10.14749/1407399495'
expect(id.value).to eq('10.14749/1407399495')
end
it 'disallows bad DOIs' do
id = Identifier.allocate
- bad_dois = %w(
+ bad_dois = %w[
20.14749/1407399495
11.14749/1407399495
10./1407399495
10.14749\1407399495
10.14749/
- )
+ ]
bad_dois.each do |doi|
expect { id.value = doi }.to raise_error(ArgumentError)
expect(id.value).to be_nil
end
end