Skip to content

Commit

Permalink
Merge pull request #170 from sul-dlss/fix-sw-doc-category-mapping#169
Browse files Browse the repository at this point in the history
Fix typo from commit f84a46e
  • Loading branch information
mejackreed committed Mar 31, 2016
2 parents b4c2d50 + 0e6179c commit e9a04a0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
13 changes: 12 additions & 1 deletion app/models/sciencewire_source_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/models/sciencewire_source_record_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e9a04a0

Please sign in to comment.