diff --git a/app/models/event.rb b/app/models/event.rb index 3c586ca32..32861acd4 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -579,7 +579,7 @@ def citation_year def date_published(doi) ## TODO: we need to make sure all the dois from other RA are indexed item = Doi.where(doi: doi_from_url(doi)).first - item[:publication_year] if item.present? + item[:publication_year].to_s if item.present? end def set_defaults diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb index c82c3e5f3..c4461ce07 100644 --- a/spec/models/event_spec.rb +++ b/spec/models/event_spec.rb @@ -34,7 +34,8 @@ it "date_published from the database" do published = subject.date_published("https://doi.org/"+doi.doi) - expect(published).to eq(2011) + expect(published).to eq("2011") + expect(published).not_to eq(2011) end end end