From 0e6179cb661284f149d29d9901d27ddfaa74a631 Mon Sep 17 00:00:00 2001 From: "Darren L. Weber, Ph.D" Date: Wed, 30 Mar 2016 14:02:44 -0700 Subject: [PATCH] Fix typo from commit f84a46e --- app/models/sciencewire_source_record.rb | 13 ++++++++++++- spec/models/sciencewire_source_record_spec.rb | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/models/sciencewire_source_record.rb b/app/models/sciencewire_source_record.rb index e74779bc8..82bc49203 100644 --- a/app/models/sciencewire_source_record.rb +++ b/app/models/sciencewire_source_record.rb @@ -250,8 +250,19 @@ def self.lookup_sw_doc_type(doc_type_list) type end + # This method maps a ScienceWire `DocumentCategory` into a corresponding + # value in `Settings.sul_doc_types`. + # + # The ScienceWire API documentation notes three valid values for the + # `DocumentCategory` field, i.e.: + # - 'Conference Proceeding Document' + # - 'Journal Document' + # - 'Other' + # + # @param sw_doc_category [String] One of the document categories + # @return sul_doc_type [String] One of the `Settings.sul_doc_types` def self.lookup_cap_doc_type_by_sw_doc_category(sw_doc_category) - if sw_doc_category =~ /^Conference Proceedings Document/i + if sw_doc_category == 'Conference Proceeding Document' return Settings.sul_doc_types.inproceedings else return Settings.sul_doc_types.article diff --git a/spec/models/sciencewire_source_record_spec.rb b/spec/models/sciencewire_source_record_spec.rb index abd75dad5..d9b3305cc 100644 --- a/spec/models/sciencewire_source_record_spec.rb +++ b/spec/models/sciencewire_source_record_spec.rb @@ -24,8 +24,8 @@ end describe '.lookup_cap_doc_type_by_sw_doc_category' do - it "maps DocumentCategory='Conference Proceedings Document' to cap type of 'inproceedings'" do - expect(SciencewireSourceRecord.lookup_cap_doc_type_by_sw_doc_category('Conference Proceedings Document')).to eq('inproceedings') + it "maps DocumentCategory='Conference Proceeding Document' to cap type of 'inproceedings'" do + expect(SciencewireSourceRecord.lookup_cap_doc_type_by_sw_doc_category('Conference Proceeding Document')).to eq('inproceedings') end it "maps DocumentCategory='Journal Document' to cap type of 'article'" do