diff --git a/spec/fixtures/files/datacite_no_series_information.xml b/spec/fixtures/files/datacite_no_series_information.xml index eb905ae95..c70451d46 100644 --- a/spec/fixtures/files/datacite_no_series_information.xml +++ b/spec/fixtures/files/datacite_no_series_information.xml @@ -16,7 +16,7 @@ Keck Institute for Space Studies 2016 - 2016-03-09 20:28:15 + 2016-03-09 English Discussion Paper diff --git a/spec/fixtures/files/datacite_series_information.xml b/spec/fixtures/files/datacite_series_information.xml index bb3ae8016..1db33bc49 100644 --- a/spec/fixtures/files/datacite_series_information.xml +++ b/spec/fixtures/files/datacite_series_information.xml @@ -16,7 +16,7 @@ Keck Institute for Space Studies 2016 - 2016-03-09 20:28:15 + 2016-03-09 English Discussion Paper diff --git a/spec/models/doi_spec.rb b/spec/models/doi_spec.rb index 30330078e..1813c1cc6 100644 --- a/spec/models/doi_spec.rb +++ b/spec/models/doi_spec.rb @@ -249,11 +249,23 @@ expect(doi.errors.details).to be_empty end + it "datetime" do + doi.dates = [{ "date" => "2019-08-01T20:28:15" }] + expect(doi.save).to be true + expect(doi.errors.details).to be_empty + end + it "invalid" do doi.dates = [{ "date" => "08/01/2019" }] expect(doi.save).to be false expect(doi.errors.details).to eq(:dates=>[{:error=>"Date 08/01/2019 is not in a supported format."}]) end + + it "invalid datetime" do + doi.dates = [{ "date" => "2019-08-01 20:28:15" }] + expect(doi.save).to be false + expect(doi.errors.details).to eq(:dates => [{:error=>"Date 2019-08-01 20:28:15 is not in a supported format."}]) + end end describe "metadata" do