Skip to content

Commit

Permalink
Merge pull request #1291 from sul-dlss/e-crez
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne authored Dec 11, 2023
2 parents 243db8c + e97ade5 commit 5f2c505
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/folio_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def to_honeybadger_context
# Course information for any courses that have this record's items on reserve
# @return [Array<Hash>] course information
def courses
item_courses = items.flat_map do |item|
item_courses = all_items.flat_map do |item|
item.fetch('courses', []).map do |course|
{
course_name: course['name'],
Expand Down
19 changes: 19 additions & 0 deletions spec/lib/folio_record_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -685,4 +685,23 @@
end
end
end

describe '#courses' do
context 'with a suppressed e-resource' do
let(:record) do
{
'items' => [{
'suppressedFromDiscovery' => true,
'courses' => [{
'name' => 'CHEM 31A'
}]
}]
}
end

it 'returns the course for the suppressed item' do
expect(folio_record.courses).to match_array(hash_including(course_name: 'CHEM 31A'))
end
end
end
end

0 comments on commit 5f2c505

Please sign in to comment.